opensearch-project / opensearch-project/OpenSearch

[BUG] Bucket aggregation fails after upgrading from 2.11 to 2.13 in BestBucketsDifferingCollector

Open
#14,799 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Search:Aggregations
Dominant language
Java
Stars
13.7k
Forks
3k
Avg merge
2d 23h
Merged PRs (30d)
108

Description

Describe the bug

After upgrading from 2.11 to 2.13, bucket aggregations queries that previously worked with terminate_after fail with

{"error":{"root_cause":[{"type":"illegal_state_exception","reason":"Cannot replay yet, collection is not finished: postCollect() has not been called"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"all_contexts4","node":"7pWVZteZQ9O-_vNCrFhj1Q","reason":{"type":"illegal_state_exception","reason":"Cannot replay yet, collection is not finished: postCollect() has not been called"}}],"caused_by":{"type":"illegal_state_exception","reason":"Cannot replay yet, collection is not finished: postCollect() has not been called","caused_by":{"type":"illegal_state_exception","reason":"Cannot replay yet, collection is not finished: postCollect() has not been called"}}},"status":500}

This is most likely coming from the changes made here https://github.com/opensearch-project/OpenSearch/pull/11421/files#diff-ce7faa9058609579cb9a555e07b5dda7699aef192a9a6252c0fcd0bdee9ff6ebR106

Related component

Search:Aggregations

To Reproduce

example query

"aggs": {
        "header": {
            "terms": {
                "field": "field1",
                "size": 100
            },
            "aggs": {
                "attributes": {
                    "nested": {
                        "path": "header2"
                    },
                    "aggs": {
                        "attribute_name_filter": {
                            "filter": {
                                "prefix": {
                                    "header3": {
                                        "value": "value1",
                                        "case_insensitive": true
                                    }
                                }
                            },
                        }
                    }
                }
            }
        }
    }
Expected behavior

Expected behavior is that the query works as it did in 2.11

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing BestBucketsDifferingCollector and the changes in pull request 11421, then reproduce the failure with the provided bucket aggregation query and terminate_after after upgrading from 2.11 to 2.13. Done means the query completes successfully without the “Cannot replay yet” exception and preserves the behavior from 2.11.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.