-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Labels
:Search Foundations/SearchCatch all for Search FoundationsCatch all for Search Foundations>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Description
Elasticsearch Version
9.1.0-SNAPSHOT
Installed Plugins
No response
Java Version
bundled
OS Version
N/A
Problem Description
Open PIT request returns the number of failed shards in the "skipped" field and the number of skipped shards in the "failed" field.
Looks like the bug has been in place since partial search was added to PIT (#111516).
I believe the fix is just to pass values in the correct order here:
elasticsearch/server/src/main/java/org/elasticsearch/action/search/OpenPointInTimeResponse.java
Line 62 in 8bcb0c4
buildBroadcastShardsHeader(builder, params, totalShards, successfulShards, failedShards, skippedShards, null); |
elasticsearch/server/src/main/java/org/elasticsearch/rest/action/RestActions.java
Lines 80 to 88 in 8bcb0c4
public static XContentBuilder buildBroadcastShardsHeader( | |
XContentBuilder builder, | |
Params params, | |
int total, | |
int successful, | |
int skipped, | |
int failed, | |
ShardOperationFailedException[] shardFailures | |
) throws IOException { |
Though we also clearly need to fill a gap in testing.
Steps to Reproduce
- Start a 2 node cluster
- Put an index with 2 shards
PUT /test
{
"settings": {
"index": {
"number_of_shards": 2,
"number_of_replicas": 0
}
}
}
- Stop one of the nodes (therefore making a shard unavailable).
- Open a PIT allowing partial search results
POST /test/_pit?keep_alive=1m&allow_partial_search_results=true
-> {
"id": "...",
"_shards": {
"total": 2,
"successful": 1,
"skipped": 1,
"failed": 0
}
}
There should be 1 shard failed, not 1 skipped. For instance, a normal search gives:
GET /test/_search
-> {
"took": 2,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 1,
"skipped": 0,
"failed": 1,
"failures": [
{
"shard": 1,
"index": "test",
"node": null,
"reason": {
"type": "no_shard_available_action_exception",
"reason": null
}
}
]
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
Logs (if relevant)
No response
Metadata
Metadata
Assignees
Labels
:Search Foundations/SearchCatch all for Search FoundationsCatch all for Search Foundations>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch