Reputation: 1046
I am using scroll api to get search results using scroll_id and my request is :
The weird thing is that as a response I am getting this:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1,
"hits": []
}
}
Is there anything that I am missing here? Why I am not getting the rest of my search results? As you can see hits property is empty.
EDIT: Just to note that when I try to get all results using scroll api then everything is ok:
https://my-es-domain-5euba7647rpc35m5utkiwweds.eu-west-1.es.amazonaws.com/_search?scroll=5m&size=3
{
"_scroll_id": "123",
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1,
"hits": [
{
"_index": "movies",
"_type": "movie",
"_id": "2",
"_score": 1,
"_source": {
"title": "Lawrence of Arabia",
"director": "David Lean",
"year": 1962,
"genres": [
"Adventure",
"Biography",
"Drama"
]
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "1",
"_score": 1,
"_source": {
"title": "The Assassination of Jesse James by the Coward Robert Ford",
"director": "Andrew Dominik",
"year": 2007,
"genres": [
"Biography",
"Crime",
"Drama"
]
}
},
{
"_index": "movies",
"_type": "movie",
"_id": "3",
"_score": 1,
"_source": {
"title": "To Kill a Mockingbird",
"director": "Robert Mulligan",
"year": 1962,
"genres": [
"Crime",
"Drama",
"Mystery"
]
}
}
]
}
}
EDIT2: My mistake. When I did first request I was already getting all three results and then when I passed scroll_id as a parameter and tried to get rest of the search results the hits array was empty:)
Upvotes: 0
Views: 303
Reputation: 642
Maybe you have only 3 documents that match this search? The first scroll returns them, and the second scroll has no more docs to retrieve
Upvotes: 2