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

Bucket script pipeline aggregation under a single bucket aggregation produces a class cast exception #119343

Open
iverase opened this issue Dec 30, 2024 · 1 comment
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@iverase
Copy link
Contributor

iverase commented Dec 30, 2024

Adding a bucket script pipeline aggregation under a single buckets aggregation like the filter aggregation results on a class class exception, for example:

POST test/_doc 
{
  "field" : "foo"
}

GET test/_search 
{
  "size": 0,
  "aggs": {
    "single_bucket": {
      "filter": {
        "exists": {
          "field": "field.keyword"
        }
      },
      "aggs": {
        "value" : {
          "cardinality": {
            "field": "field.keyword"
          }
        },
        "bucket_script": {
          "bucket_script": {
            "buckets_path": {
              "card" : "value"
            },
            "script": "params.card + 1"
          }
        }
      }
    }
  }
}

Output:

{
  "error": {
    "root_cause": [],
    "type": "search_phase_execution_exception",
    "reason": "",
    "phase": "rank-feature",
    "grouped": true,
    "failed_shards": [],
    "caused_by": {
      "type": "class_cast_exception",
      "reason": "class org.elasticsearch.search.aggregations.bucket.filter.InternalFilter cannot be cast to class org.elasticsearch.search.aggregations.InternalMultiBucketAggregation (org.elasticsearch.search.aggregations.bucket.filter.InternalFilter and org.elasticsearch.search.aggregations.InternalMultiBucketAggregation are in module org.elasticsearch.server@8.17.0 of loader 'app')"
    }
  },
  "status": 500
}
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Dec 30, 2024
@elasticsearchmachine
Copy link
Collaborator

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

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

No branches or pull requests

2 participants