elastic / elastic/elasticsearch

Inconsistent _search behavior for all shards failure between local and remote clusters

Open
#129,083 2 comments 0 reactions 0 assignees View on GitHub
:Search Foundations/CCS >bug medium-risk Team:Search Foundations
Dominant language
Java
Stars
77.9k
Forks
26.1k
PR merge metrics
PR metrics pending

Description

### Elasticsearch Version

8.18, 9.0

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

*

### Problem Description

When all shards fail on a cluster, ES returns an error even when `allow_partial_search_results=true`. However, if two clusters are involved, the behavior is inconsistent. If all shards on the remote fail, the result is partial with the non-failing results from local and remote set to skipped. However, if all shards on the local fail (but remote succeeds) the result is a failure and the remote results are ignored.

Note this only happens on MRT=true but MRT=false works as expected.

### Steps to Reproduce

1. Set up two clusters, local and remote1
2. Create index "blogs" on both, preferably with multiple shards
3. Run this query:
```
POST /blogs,remote1:blogs/_search?allow_partial_search_results=true&ccs_minimize_roundtrips=true
{
"size": 0,
"query": {
"error_query": {
"indices": [
{
"name": "blogs",
"error_type": "exception",
"message": "local cluster exception"
}
]
}
},
"aggs": {
"indexgroup": {
"terms": {
"field": "_index"
}
}
}
}
```
4. Change index name to `remote1:blogs` and try again.

### Logs (if relevant)

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.