Skip to content

Bucket path name resolution fails with siblings and child aggregations with the same name #30608

@ruizmarc

Description

@ruizmarc

Elasticsearch version (bin/elasticsearch --version): 6.2.4

Plugins installed: No plugins installed

JVM version (java -version): java version "1.8.0_25"

OS version (uname -a if on a Unix-like system): Darwin Kernel Version 17.5.0

Description of the problem including expected versus actual behavior:

When trying to use a pipeline aggregation on a date histogram, bucket_path cannot properly be resolved if it is pointing to a child aggregation of the date histogram if a sibling aggregation (pipeline aggregation's sibling) has the same name as the child aggregation of the date histogram. (see example).

I would expect that elasticsearch could properly resolve the path, as it doesn't seem to exist an ambiguation. Maybe I'm wrong with this and it should behave as it is behaving...

Steps to reproduce:

Here you have a simple query example that allows to reproduce the problem

{
  "query": { "match_all": {} },
  "size": 0,
  "aggs": {
    "sessionsCount": {
      "filter": {
        "bool": {
          "must": [
            {
              "terms": {
                "status": [
                  "FINISHED"
                ]
              }
            }
          ]
        }
      }
    },
    "monthlyAverageSessions": {
      "avg_bucket": {
        "buckets_path": "monthBuckets>sessionsCount>_count",
        "gap_policy": "insert_zeros"
      }
    },
    "monthBuckets": {
      "date_histogram": {
        "field": "startTimestamp",
        "interval": "month"
      },
      "aggs": {
        "sessionsCount": {
          "filter": {
            "bool": {
              "must": [
                {
                  "terms": {
                    "status": [
                      "FINISHED"
                    ]
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}

And this is the error that I receive.

"{\"error\":{\"root_cause\":[],\"type\":\"search_phase_execution_exception\",\"reason\":\"\",\"phase\":\"fetch\",\"grouped\":true,\"failed_shards\":[],\"caused_by\":{\"type\":\"class_cast_exception\",\"reason\":\"org.elasticsearch.search.aggregations.bucket.filter.InternalFilter cannot be cast to org.elasticsearch.search.aggregations.InternalMultiBucketAggregation\"}},\"status\":503}"

Any of both aggregations works fine if they are not together (sessionsCount and monthlyAverageSessions). And it also works well if I change the name of the first aggregation (sessionsCount) to a different one (sessions for example). So it looks like a naming problem.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions