title: How do I reduce Elasticsearch scroll response time?
body: <p>I have a query returning ~200K hits from 7 different indices distributed across our cluster. I process my results as:</p>
  
  <pre><code>while (true) {
      scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet();
  
      for (SearchHit hit : scrollResp.getHits()){
              //process hit}
  
      //Break condition: No hits are returned
      if (scrollResp.hits().hits().length == 0) {
          break;
      }
  }
  </code></pre>
  
  <p>I'm noticing that the client.prepareSearchScroll line can hang for quite some time before returning the next set of search hits. This seems to get worse the longer I run the code for.</p>
  
  <p>My setup for the search is:</p>
  
  <pre><code>SearchRequestBuilder searchBuilder = client.prepareSearch( index_names )
      .setSearchType(SearchType.SCAN)
      .setScroll(new TimeValue(60000)) //TimeValue?
      .setQuery( qb )
      .setFrom(0) //?
      .setSize(5000); //number of jsons to get in each search, what should it be? I have no idea.
      SearchResponse scrollResp = searchBuilder.execute().actionGet();
  </code></pre>
  
  <p>Is it expected that scanning and scrolling just takes a long time when examining many results? I'm very new to Elastic Search so keep in mind that I may be missing something very obvious.</p>
  
  <p>My query:</p>
  
  <pre><code>QueryBuilder qb = QueryBuilders.boolQuery().must(QueryBuilders.termsQuery("tweet", interesting_words));
  </code></pre>