title: ElasticSearch Scroll API with multi threading
body: <p>First of all, I want to let you guys know that I know the basic work logic of how ElasticSearch Scroll API works. To use <strong>Scroll</strong> API, first, we need to call <strong>search</strong> method with some scroll value like <strong>1m</strong>, then it will return a <strong>_scroll_id</strong> that will be used for the next consecutive calls on Scroll until all of the doc returns within loop. But the problem is I just want to use the same process on multi-thread basis, not on serially. For example:</p>
  
  <p>If I have 300000 documents, then I want to process/get the docs this way</p>
  
  <ul>
  <li>The 1st thread will process <strong>initial</strong> 100000 documents </li>
  <li>The 2nd thread will process <strong>next</strong> 100000 documents </li>
  <li>The 3rd thread will process <strong>remaining</strong> 100000 documents</li>
  </ul>
  
  <p>So my question is as I didn't find any way to set the <strong>from</strong> value on scroll API how can I make the scrolling process faster with threading. Not to process the documents in a serialized manner.</p>
  
  <p><strong>My sample python code</strong> </p>
  
  <pre><code>if index_name is not None and doc_type is not None and body is not None:
     es = init_es()
     page = es.search(index_name,doc_type, scroll = '30s',size = 10, body = body)
     sid = page['_scroll_id']
     scroll_size = page['hits']['total']
  
     # Start scrolling
     while (scroll_size &gt; 0):
  
         print("Scrolling...")
         page = es.scroll(scroll_id=sid, scroll='30s')
         # Update the scroll ID
         sid = page['_scroll_id']
  
         print("scroll id: " + sid)
  
         # Get the number of results that we returned in the last scroll
         scroll_size = len(page['hits']['hits'])
         print("scroll size: " + str(scroll_size))
  
         print("scrolled data :" )
         print(page['aggregations'])
  </code></pre>