Skip to content

Commit 0ff4a3d

Browse files
authored
Added _shards.failed and _shards.failures explanation (#2519)
Added `_shards.failed` and `_shards.failures` explanation.
1 parent bf9335d commit 0ff4a3d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

solutions/search/the-search-api.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,38 @@ The response will not contain any hits as the `size` was set to `0`. The `hits.t
374374
```
375375

376376
The `took` time in the response contains the milliseconds that this request took for processing, beginning quickly after the node received the query, up until all search related work is done and before the above JSON is returned to the client. This means it includes the time spent waiting in thread pools, executing a distributed search across the whole cluster and gathering all the results.
377+
378+
`_shards.failed` indicates how many shards did not successfully return results for the search request. `_shards.failures` is returned only when shard failures occur and contains an array of objects with details such as the index name, shard number, node ID, and the reason for the failure.
379+
380+
```console-result
381+
"_shards": {
382+
"total": 5,
383+
"successful": 1,
384+
"skipped": 0,
385+
"failed": 4,
386+
"failures": [
387+
{
388+
"shard": 0,
389+
"index": "<index_name>",
390+
"node": "<node_id>",
391+
"reason": {
392+
"type": "node_not_connected_exception",
393+
"reason": "[<node_name>][<ip>:<port>] Node not connected"
394+
}
395+
},
396+
{
397+
"shard": 1,
398+
"index": "<index_name>",
399+
"node": null,
400+
"reason": {
401+
"type": "no_shard_available_action_exception",
402+
"index_uuid": "<index_uuid>",
403+
"shard": "1",
404+
"index": "<index_name>"
405+
}
406+
}
407+
]
408+
}
409+
```
410+
411+
Shard failures are deduplicated by `index` and `exception`. If the same exception occurs multiple times on the same index, it is reported only once in `_shards.failures`, even if multiple shards failed. As a result, the number of entries in `_shards.failures` can be lower than the value in `_shards.failed`.

0 commit comments

Comments
 (0)