1

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?

Amir M
  • 508
  • 1
  • 8
  • 28

2 Answers2

0

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.

Alex Baidan
  • 1,065
  • 7
  • 15
  • Thanks but I'm still getting SUCCESS: { "snapshot": { "snapshot": "snap_test_X", "uuid": "iihDBPjoS2mdjaBnzRaGrA", "repository": "my_backup", "version_id": 8020299, "version": "8.2.2", "indices": [ ".geoip_databases", "index_1000_6_1", ".security-7" ], "data_streams": [], "include_global_state": true, "state": "SUCCESS",...... "failures": [],.... – Amir M Jul 17 '22 at 10:49
  • 1
    Looks like you are right, and something is going wrong. Just played with snapshots, options and closed indexes. I can confirm that even after closing index are in snapshot. If delete index and restore it after from snapshot - index will be in open state. It looks like a bug, and may be will be good if you will open in in elasticsearch repository. – Alex Baidan Jul 17 '22 at 17:54
  • According to the elastic team there is probably a mistake in the docs - https://discuss.elastic.co/t/succeeded-to-take-snapshot-of-closed-elasticsearch-index-with-ignore-unavailable-false/309853 I opened a bug: https://github.com/elastic/elasticsearch/issues/88582 – Amir M Jul 18 '22 at 09:17
0

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.

Amir M
  • 508
  • 1
  • 8
  • 28