The second question is: When i use scroll search wiht scroll id and i have less than 10 documents i have no results (ex. hits[] ) but if i have more than 10 doc i have results. How it's possible? There is some settings to change?
It is deprecated indeed. What you do with a scroll request that sorts on _doc is the right thing to do.
Maybe you are confused because a simple scroll already returns documents on the first request (on the contrary to scans which used to only count results on the first request and would only return hits on further calls to the scroll api).
Now, i have a new question...if i use the scroll api or a normal search on my alias for a "match_all" query with the maximum size of the index...i have the same result...
So in this case the scroll api is useless becouse i can use a normal query on alias save the data then use the bulk api for insert them on the new index.
If i'm on the correct way....what is the utility to use the scroll api for reindex (recommended on the documentation of ES)?
The utility is that a regular search operation is very bad at fetching lots of records at once. It might work in your case if you don't have many documents, but otherwise the fact that it needs to fetch all matching documents and put them in a single json document will likely make your system go out of memory.
right, but for use scroll api i need to do a lot number of query for take all results, this can be slowed; and for use _search/scroll...before i need to do another query _search?scroll=1m for active the scroll_id (this isn't consistent for me).
So i have a large number of scroll query or a big json document and in both cases my system can go out of memory.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.