Linux 3acef6594579 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 9 22:39:36 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Problem Description
Under specific conditions I am hitting a runtime_exception when using some specific aggregations. Namely, a terms and cardinality aggregation inside a terms aggregation inside a nested aggregation. See the reproduction steps below.
The error is:
{
"error": {
"root_cause": [
{
"type": "runtime_exception",
"reason": "score for different docid, nesting an aggregation under a children aggregation and terms aggregation with collect mode breadth_first isn't possible"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "my_index",
"node": "i6xLcTXyT1SrJ5LhtKyUjg",
"reason": {
"type": "runtime_exception",
"reason": "score for different docid, nesting an aggregation under a children aggregation and terms aggregation with collect mode breadth_first isn't possible"
}
}
],
"caused_by": {
"type": "runtime_exception",
"reason": "score for different docid, nesting an aggregation under a children aggregation and terms aggregation with collect mode breadth_first isn't possible",
"caused_by": {
"type": "runtime_exception",
"reason": "score for different docid, nesting an aggregation under a children aggregation and terms aggregation with collect mode breadth_first isn't possible"
}
}
},
"status": 500
}
I can work around this by adding execution_hint: direct to the cardinality aggregation, but from reading the code this appears to be a bug since the MultiBucketCollector is defaulting to ScoreMode.COMPLETE even though the sub-aggregations do not need any scoring (here).
Elasticsearch Version
8.15
Installed Plugins
No response
Java Version
bundled
OS Version
Linux 3acef6594579 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 9 22:39:36 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Problem Description
Under specific conditions I am hitting a runtime_exception when using some specific aggregations. Namely, a terms and cardinality aggregation inside a terms aggregation inside a nested aggregation. See the reproduction steps below.
The error is:
Steps to Reproduce
I can work around this by adding
execution_hint: direct
to thecardinality
aggregation, but from reading the code this appears to be a bug since the MultiBucketCollector is defaulting to ScoreMode.COMPLETE even though the sub-aggregations do not need any scoring (here).Logs (if relevant)
No response