# Nested Aggregation on percolator type throws UnsupportedOperationException

**URL:** <https://discuss.elastic.co/t/nested-aggregation-on-percolator-type-throws-unsupportedoperationexception/1889>\
**Category:** Elasticsearch\
**Created:** [June 4, 2015, 12:33am UTC](https://discuss.elastic.co/t/nested-aggregation-on-percolator-type-throws-unsupportedoperationexception/1889 "2015-06-04T00:33:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taras](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/taras/32/507_2.png) [@taras](https://discuss.elastic.co/u/taras)\
**Post date:** [June 4, 2015, 12:33am UTC](https://discuss.elastic.co/t/nested-aggregation-on-percolator-type-throws-unsupportedoperationexception/1889/1 "2015-06-04T00:33:47Z")

</div>

I wanted to aggregate my percolation results with a _nested_ aggregation. However, it appears that code path isn't implemented.

PercolateContext.java  
@Override  
public MapperService.SmartNameObjectMapper smartNameObjectMapper(String name) {  
throw new UnsupportedOperationException();  
}

Is there support for this coming soon? It would be nice utility that would help avoid duplicating percolators.

Here is the script to reproduce the problem

```
PUT /classify
{
  "mappings":{
    ".percolator":{
      "properties": {
        "query" : {
          "type" : "object",
          "enabled" : false
        },
        "isa":{
          "type": "nested",
          "properties":{
            "feature":{
              "type": "string"
            },
            "id": {
              "type": "string"
            }
          }
        }
      }
    },
    "thing":{
      "properties":{
        "name":{
          "type":"string"
        }
      }
    }
  }
}

POST classify/.percolator/1234
{
  "query": {
    "match": {
      "name": "arts"
    }
  },
  "type": "thing",
  "isa":[{
    "feature": "Category",
    "id": "theatre"
  },
  {
    "feature": "Ambience",
    "id": "classy"
  }
  ]
}

GET /classify/thing/_percolate
{
  "doc": {
    "name": "Academy of Arts"
  },
  "aggs":{
    "isa":{
      "nested": {
        "path": "isa"
      },
      "aggs": {
        "features": {
          "terms": {
            "field": "isa.feature"
          },
          "aggs": {
            "kinds": {
              "terms": {
                "field": "isa.id"
              }
            }
          }
        }
      }
    }
  }
}
```

---

<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:** [July 6, 2017, 12:09am UTC](https://discuss.elastic.co/t/nested-aggregation-on-percolator-type-throws-unsupportedoperationexception/1889/2 "2017-07-06T00:09:46Z")

</div>


