Skip to content

Pipeline metrics aggregations do not recognize composite aggregations as multi-bucket #32692

@ghost

Description

Elasticsearch version (bin/elasticsearch --version): 6.3.0 official docker image

Plugins installed: []

JVM version (java -version): 10.0.1

OS version (uname -a if on a Unix-like system):
Linux 389f11186e5b 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
Haven't seen the Git issue posted for this thread, so I'm posting it to get the ball rolling since my team has encountered it as well.

Pipeline metrics aggregations do not recognize composite aggregations as multi-bucket. However, composite aggregations are multi-bucket, so this should work.

Steps to reproduce:

  1. Template mapping
PUT _template/template_default
   {
   	"mappings": {
   	  "_doc": {
   		"_all": {
   				  "enabled": false
   			  },
   			"dynamic": "strict",
   			"properties": {
   				"itemId": {
   				   "type": "keyword",
   				   "norms": false
   				},
   				"inputQty": {
   				   "type": "integer",
   				   "index": false
   				},
   				"orderQty": {
   				   "type": "integer",
   				   "index": false
   				},
   				"centerId": {
   					"type": "keyword",
   					"eager_global_ordinals": true,
   					"norms": false
   				},
   				"submittedQty": {
   					"type": "integer",
   					"index": false
   				},
   				"confirmedQty": {
   					"type": "integer",
   					"index": false
   				}
   		}
   	  }
   	}
   }
  1. REST call
POST items-0*/_search?ignore_unavailable=true
   {
   	"size": 0,
   	"track_total_hits": false,
   	"aggs" : {
   	  "myBuckets" : {
   		"composite" : {
   		  "size" : 100000,
   		  "sources" : [
   			  { "center_name" : { "terms" : { "field" : "centerId"} } }
   			]
   		  },
   		  "aggs" : {
   			"requested_units" : { "sum": { "field" : "inputQty" } },
   			"approved_units"  : { "sum": { "field" : "orderQty" } },
   			"submitted_quantity" : { "sum" : { "field" : "submittedQty"} },
   			"confirmed_quantity" : { "sum" : { "field" : "confirmedQty"} }
   		  }
   	  },
   	  "check_pipeline_agg": {
   		"sum_bucket": {
   		  "buckets_path": "fc_buckets>requested_units"
   		}
   	  }
   	}
   }

Provide logs (if relevant):
The error that comes back will be similar to:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "The first aggregation in buckets_path must be a multi-bucket aggregation for aggregation [avg_cardinality] found :org.elasticsearch.search.aggregations.bucket.composite.CompositeAggregationBuilder for buckets path: composite_buckets>cardinality_some_field"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "my_index",
        "node": "1_8dwXRuT565uQg11iZ_SA",
        "reason": {
          "type": "illegal_argument_exception",
          "reason": "The first aggregation in buckets_path must be a multi-bucket aggregation for aggregation [avg_cardinality] found :org.elasticsearch.search.aggregations.bucket.composite.CompositeAggregationBuilder for buckets path: composite_buckets>cardinality_some_field"
        }
      }
    ],
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "The first aggregation in buckets_path must be a multi-bucket aggregation for aggregation [avg_cardinality] found :org.elasticsearch.search.aggregations.bucket.composite.CompositeAggregationBuilder for buckets path: composite_buckets>cardinality_some_field",
      "caused_by": {
        "type": "illegal_argument_exception",
        "reason": "The first aggregation in buckets_path must be a multi-bucket aggregation for aggregation [avg_cardinality] found :org.elasticsearch.search.aggregations.bucket.composite.CompositeAggregationBuilder for buckets path: composite_buckets>cardinality_some_field"
      }
    }
  },
  "status": 400
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions