Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggs: breadth_first does not work on several levels #9823

Closed
jpountz opened this issue Feb 23, 2015 · 0 comments · Fixed by #10411
Closed

Aggs: breadth_first does not work on several levels #9823

jpountz opened this issue Feb 23, 2015 · 0 comments · Fixed by #10411
Assignees

Comments

@jpountz
Copy link
Contributor

jpountz commented Feb 23, 2015

Probably introduced in #9544 since I can reproduce the issue on master but not 1.x. The following recreation generates an error: Deferred collectors cannot be collected directly. They must be collected through the recording wrapper.

DELETE test

PUT test
{
  "mappings": {
    "test": {
      "properties": {
        "a": {
          "type": "string",
          "index": "no",
          "doc_values": "yes"
        },
        "b": {
          "type": "string",
          "index": "no",
          "doc_values": "yes"
        },
        "c": {
          "type": "string",
          "index": "no",
          "doc_values": "yes"
        }
      }
    }
  }
}

PUT test/test/1
{
  "a": "foo",
  "b": "bar",
  "c": "baz"
}

GET test/_search
{
  "aggs": {
    "a_terms": {
      "terms": {
        "field": "a",
        "collect_mode": "breadth_first"
      },
      "aggs": {
        "b_terms": {
          "terms": {
            "field": "b",
            "collect_mode": "breadth_first"
          },
          "aggs": {
            "c_terms": {
              "terms": {
                "field": "c"
              }
            }
          }
        }
      }
    }
  }
}
@jpountz jpountz self-assigned this Feb 23, 2015
@jpountz jpountz changed the title Aggs: breadth_first does not work on several leves Aggs: breadth_first does not work on several levels Apr 3, 2015
jpountz added a commit to jpountz/elasticsearch that referenced this issue Apr 3, 2015
The refactoring in elastic#9544 introduced a regression that broke multi-level
aggregations using breadth-first. This was due to sub-aggregators creating
deferred collectors before their parent aggregator and then the parent
aggregator trying to collect sub aggregators directly instead of going through
the deferred wrapper.

This commit fixes the issue but we should try to simplify all the pre/post
collection logic that we have.

Also `breadth_first` is now automatically ignored if the sub aggregators need
scores (just like we ignore `execution_mode` when the value does not make sense
like using ordinals on a script).

Close elastic#9823
jpountz added a commit to jpountz/elasticsearch that referenced this issue Apr 9, 2015
The refactoring in elastic#9544 introduced a regression that broke multi-level
aggregations using breadth-first. This was due to sub-aggregators creating
deferred collectors before their parent aggregator and then the parent
aggregator trying to collect sub aggregators directly instead of going through
the deferred wrapper.

This commit fixes the issue but we should try to simplify all the pre/post
collection logic that we have.

Also `breadth_first` is now automatically ignored if the sub aggregators need
scores (just like we ignore `execution_mode` when the value does not make sense
like using ordinals on a script).

Close elastic#9823
jpountz added a commit to jpountz/elasticsearch that referenced this issue Apr 9, 2015
The refactoring in elastic#9544 introduced a regression that broke multi-level
aggregations using breadth-first. This was due to sub-aggregators creating
deferred collectors before their parent aggregator and then the parent
aggregator trying to collect sub aggregators directly instead of going through
the deferred wrapper.

This commit fixes the issue but we should try to simplify all the pre/post
collection logic that we have.

Also `breadth_first` is now automatically ignored if the sub aggregators need
scores (just like we ignore `execution_mode` when the value does not make sense
like using ordinals on a script).

Close elastic#9823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant