Reindex a red index (allow_partial_search_results error)

hi all
I have a red index with 5 primary and replica shards which data of shard [2] (both primary and replica) is missed.

I want to reindex my index to a new one using below api in order to change its status from red to green:

POST _reindex
{
  "source" : {
    "index" : "myindex_2024.02"
  
},

 "dest" : {
   "index": "myindex_new_2024.02"
 }

}

the result of reindex api in dev tools is as below:

{
"error": {
"root_cause": ,
"type": "search_phase_execution_exception",
"reason": "start",
"phase": "can_match",
"grouped": true,
"failed_shards": ,
"caused_by": {
"type": "search_phase_execution_exception",
"reason": "Search rejected due to missing shards [[myindex_2024.02][2]]. Consider using allow_partial_search_results setting to bypass this error.",
"phase": "can_match",
"grouped": true,
"failed_shards":
}
},
"status": 503
}

based on the search on the Internet, I use below api to handle above issue, but the result of the reindex api is the same and has the same error.

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

how can i handle this issue and trun the status of index from red to green. notably there is no snapshot of the mentioned index.

any help will be so appreciated.

If both the primary and replica is missing it is important to figure out the cause so it can be prevented from happening again. Instead of reindexing you could use the cluster reroute API to allocate an empty shard to replace the missing shard (see the allocate_empty_primary parameter), which may be easier.

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