Scroll search request returns documents but Scan does not

(lisak) #1


I'm talking about the initial search request only, not the following scroll requests. If I do this :
GET foo/_search?scroll=5m&search_type=scan
I get scroll_id and an empty hits array :

   "_scroll_id": "foo",  
   "hits": {
      "total": 270223,
      "max_score": 0,
      "hits": []

But if I don't set search_type to scan :
GET foo/_search?scroll=5m
I get scroll_id AND the first batch of results !

This is a total drag because you can't maintain any kind of abstraction over scrolling components that are both scrolling and scanning.

EDIT: I just noticed of this comment in documentation that compares scroll with scan :

The response of the initial search request will not contain any results in the hits array. The first results will be returned by the first scroll request.

(system) #2