Kenyore
Kenyore

Reputation: 56

Elasticsearch scroll API returns terminated_early without scroll_id

I'm using elasticsearch-7.8.1 and following the scroll API to scroll datas.My data count is 356054 and get 10 per request.

But after my first scroll request,I just got a "terminated_early ":true and no further scroll_id for me to make next request.

Is there something wrong?

Below is my requests and responses.

Search request

POST http://192.168.10.168:9200/index_name/_search?scroll=60m
{
    "query": {
        "match_all": {}
      }
}

Response

{
    "_scroll_id": "FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFERvaGtyM01CNExwbm50ZG1DNFAtAAAAAAAADLUWSDgxaWkwdUNSNktWYk0xbUw1aG00dw==",
    "took": 2,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 356054,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [//datas]
    }
}

Scroll request

POST http://192.168.10.168:9200/_search/scroll
{
    "scroll_id": "FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFERvaGtyM01CNExwbm50ZG1DNFAtAAAAAAAADLUWSDgxaWkwdUNSNktWYk0xbUw1aG00dw=="
}

Response

{
    "took": 1,
    "timed_out": false,
    "terminated_early": true,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 356054,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [//datas]
    }
}

Upvotes: 0

Views: 889

Answers (1)

Oliver Cooper
Oliver Cooper

Reputation: 845

I know it's been a little while since you asked, but if anyone stumbles upon this from a Google search:

You need to specify scroll (i.e. 1m) in the scroll request body. For example:

POST http://192.168.10.168:9200/_search/scroll
{
    "scroll_id": "FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFERvaGtyM01CNExwbm50ZG1DNFAtAAAAAAAADLUWSDgxaWkwdUNSNktWYk0xbUw1aG00dw==",
    "scroll": "1m"
}

I ran in to the same issue and it appears to have solved the problem.

Upvotes: 1

Related Questions