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

ClassCastException in SignificantTermsAggregation #108427

Closed
not-napoleon opened this issue May 8, 2024 · 1 comment · Fixed by #108429
Closed

ClassCastException in SignificantTermsAggregation #108427

not-napoleon opened this issue May 8, 2024 · 1 comment · Fixed by #108429
Assignees
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@not-napoleon
Copy link
Member

Elasticsearch Version

main, and at least back to 8.10

Installed Plugins

No response

Java Version

bundled

OS Version

n/a

Problem Description

ClassCastException when running SignificantTerms aggregation on fields with the same name and different types

Steps to Reproduce

PUT /index1
{
  "mappings": {
    "properties": {
      "field":    { "type": "long" }
    }
  }
}

PUT /index2
{
  "mappings": {
    "properties": {
      "field":    { "type": "keyword" }
    }
  }
}

POST index1/_doc
{
   "field":  [1, 10]
}

POST index2/_doc
{
   "field":  ["1", "x"]
}


GET index*/_search
{
  "size": 0,
  "aggs": {
    "st": {
      "significant_terms": {
        "field": "field"
      }
    }
  }
}

Logs (if relevant)

No response

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 8, 2024
not-napoleon added a commit that referenced this issue May 9, 2024
Prior to this PR, if a SignificantTerms aggregation targeted a field existing on two indices (that were included in the aggregation) but mapped to different field types, the query would fail at reduce time with a somewhat obscure ClassCastException. This change brings the behavior in line with the Terms aggregation, which returns a 400 class IllegalArgumentException with a useful message in this situation.

Resolves #108427
markjhoy pushed a commit to markjhoy/elasticsearch that referenced this issue May 9, 2024
Prior to this PR, if a SignificantTerms aggregation targeted a field existing on two indices (that were included in the aggregation) but mapped to different field types, the query would fail at reduce time with a somewhat obscure ClassCastException. This change brings the behavior in line with the Terms aggregation, which returns a 400 class IllegalArgumentException with a useful message in this situation.

Resolves elastic#108427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants