title: Scan and scroll query not working when combined with range query in Elasticsearch
body: <p>I am trying to use Java API for executing scan and scroll query while combining it with range query but I am not getting any hits. I am not sure if it's a problem with my query or my data but below is my code:</p>
  
  <pre><code>String from = "1429192800000";
  String to = "1429193100000";
  
  QueryBuilder qb = rangeQuery("myField")
                   .gte(from)
                   .lte(to);
  
  SearchRequestBuilder searchBuilder = client.prepareSearch(oldIndex)
                                       .setTypes("myType")
                                       .setSearchType(SearchType.SCAN)
                                       .setScroll(new TimeValue(60000))
                                       .setQuery(qb)
                                       .setSize(100);
  </code></pre>
  
  <p>And here's my output:</p>
  
  <pre><code>{
     "_scroll_id" : my64BitScrolliD,
     "took" : 576,
     "timed_out" : false,
     "_shards" : {
     "total" : 15,
     "successful" : 15,
     "failed" : 0
  },
  "hits" : {
     "total" : 0,
     "max_score" : 0.0,
     "hits" : [ ]
  }
  }
  </code></pre>
  
  <p>I have tried querying without using java api and still it doesn't return any hits. Here's my query:</p>
  
  <pre><code>  curl -XGET "http://localhost:9220/path/to/cluster/myIndex/myType/_search?search_type=scan&amp;scroll=1m -d '{
       "size": 100,
       "query": {
          "range": {
            "myField": {
              "from": "1429192800000",
              "to": "1429193100000"
            }
          }
       }
    }'
  </code></pre>
  
  <p>And I get the same output as above. The field for which I have applied the range query holds an epoch timestamp and data exists between the specified range so there is no mistake with the query I suppose (I have tested it with just _search API and without using scan and scroll and it returned me hits!). </p>
  
  <p>I would like to add that the scan and scroll query works fine if I don't combine range query with it! Since there is a really large amount of data, I want to get the results in batches by specifying the time range. Am I missing something basic here? Let me know if any more information is required.</p>