Home > Net >  Succeeded to take snapshot of closed Elasticsearch index with ignore_unavailable=false
Succeeded to take snapshot of closed Elasticsearch index with ignore_unavailable=false

Time:07-19

According to the Elasticsearch Create snapshot API documentation, when creating a manual snapshot of a closed index with ignore_unavailable = false - the snapshot should fail:

ignore_unavailable (Optional, Boolean) If false, the snapshot fails if any data stream or index in indices is missing or closed.

I'm using elasicsearch 8.2 and closed one of my indices (e.g. "index_1000_6_1" - I validated it is actualy close).

POST https://someuri:9200/index_1000_6_1/_close

Response:

{
    "acknowledged": true,
    "shards_acknowledged": true,
    "indices": {
        "index_1000_6_1": {
            "closed": true
        }
    }
}

I'm taking a snapshot of this index with "ignore_unavailable":"false" but the request scceeded, nothing fails and the snapshot is being created.

PUT https://someuri:9200/_snapshot/my_backup/snap_test
{
"indices":"index_1000_6_1",
"wait_for_completion":"true",
"ignore_unavailable":"false"
}

Response:

{
    "accepted": true
}

What am I missing?

CodePudding user response:

The reason here is that you are using "wait_for_completion":"true" in request body, but it must be used as query param. In fact you are not waiting for result, but just setting background job and getting acknowledgement that it was setted.

Try:

PUT https://someuri:9200/_snapshot/my_backup/snap_test?wait_for_completion=true
{
"indices":"index_1000_6_1",
"ignore_unavailable":"false"
}

Here you should get right details.

CodePudding user response:

There was a mistake in the docs. This is the updated documentation:

ignore_unavailable (Optional, Boolean) If false, the request returns an error for any snapshots that are unavailable. Defaults to false.

If true, the request ignores snapshots that are unavailable, such as those that are corrupted or temporarily cannot be returned.

  • Related