Nested Aggregation on percolator type throws UnsupportedOperationException


(Taras Shkvarchuk) #1

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"
              }
            }
          }
        }
      }
    }
  }
}

(system) #2