Search to only return when all shards are successful

I am using ES 5.5 and prepareSearch.get to search for results.

https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search.html

The search API call in ES returns data on successful and failed shards, but the transport client does not return this in the response. Is there a way to get these stats with each prepareSearch call?

Also, is there a way to fail search requests when there are failed shards?

I got the answer for the second question. The searchResponse from transport client has getFailedShards() as int.

So, I can add a check for failed shards and if so fail this search response and retry again later. But is there a server config for this?

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