Reindex corrupted index into a new copy

Hello,

Is it possible to reindex a corrupted index into a new copy accepting some data loss?
I am trying to reindex a corrupted index with the following call:

POST _reindex
{
 "source": {
   "index": "index001"
 },
 "dest": {
   "index": "index001-copy"
 }
}

However, when I do so, I receive the following error message:
Search rejected due to missing shards [[index001][1]]. Consider using 'allow_partial_search_results' setting to bypass this error.

_reindex call doesnt accept the setting allow_partial_search_results so I tried to setup the cluster with a default value which didn't help either as it keeps showing the same reindex error message, the default cluster setting I modified is:

PUT _cluster/settings
{
    "persistent" : {
        "search.default_allow_partial_results" : true
    }
}

The primary shard has a replica shard that hasn't been assigned to a node since its primary is corrupted, if reindex is not an option, can the replica be promoted as primary?

Elasticsearch version is 7.16.3 running under CentOS 7.

Thank you,

Does anyone know what to do in this case?

If you had a valid replica that would have been promoted to primary once the primary got corrupted. You therefore probably have lost the data in that shard. How many primary shards does the index have?

I believe you can use the cluster reroute API to force allocate the missing shard. It has options allocate_stale_primary and allocate_empty_primary to force allocation, but this may lead to some or all data held on that shard to be lost. The appropriate one to use depends on the exact status of the index.

The index has 8 primaries and 8 replicas, I will take a look at the cluster reroute api documentation and see if that fits.
Thank you for your answer.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.