# Pipelines and nested aggs

**URL:** https://discuss.elastic.co/t/pipelines-and-nested-aggs/95089
**Category:** Elasticsearch
**Created:** [July 30, 2017, 6:56pm UTC](https://discuss.elastic.co/t/pipelines-and-nested-aggs/95089 "2017-07-30T18:56:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![PaulieMac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pauliemac/32/19480_2.png) [@PaulieMac](https://discuss.elastic.co/u/PaulieMac)
#### Post date: [July 30, 2017, 6:56pm UTC](https://discuss.elastic.co/t/pipelines-and-nested-aggs/95089/1 "2017-07-30T18:56:46Z")

</div>

Hi all,

Anyone know if it is possible to do pipeline aggs when the sibling agg is nested? I always get the following error:

"reason" : "org.elasticsearch.search.aggregations.bucket.nested.InternalNested cannot be cast to org.elasticsearch.search.aggregations.InternalMultiBucketAggregation"

The query and the mapping are quite complex, so I haven't posted them, but will if it helps. I presume it is simply not supported at the moment, but it would be really useful to be able to use pipeline aggs in this way 🙂

I should note - I have posted a second question re copying values from a parent down into it's nested children; that is for a workaround to this issue...

Here is a (much simplified) snippet of the query I have been trying:

```auto
		"aggs" : {
			"detail" : {
				"nested": {
					"path": "obs"
				},
				"aggs": {
					"inner_detail" :{
						"filters": {
							"filters" : [ {
								"bool": {
									"should": [
										{
											"term": {
												"obs.hr": "17"
											}
										},
										{
											"term": {
												"obs.hr": "18"
											}
										}
									]
								}
							} ]
						},
						"aggs": {
							"max": {
								"max": {
									"field": "obs.tempc"
								}
							}
						}
					},
					"max": {
						"max_bucket": {
							"buckets_path": "inner_detail>max"
						}
					}
				}
			},
			"max": {
				"max_bucket": {
					"buckets_path": "detail>max"
				}
			}
		}

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 27, 2017, 6:57pm UTC](https://discuss.elastic.co/t/pipelines-and-nested-aggs/95089/2 "2017-08-27T18:57:13Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
