Search code examples
elasticsearchsnapshotelasticsearch-api

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


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?


Solution

  • 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.