How can I use Aggregation by result by match_phase?

Enviroment

ES 5.2

sample is not working

{
  "from": 0,
  "size": 0,
  "aggs": {
    "image_tag" : {
      "children": {
        "type": "review"
      },
      "aggs": {
        "image_tags" : {
            "filter": {"query": {"match_phrase": {
              "user_comment": "hogehoge"
            }}} 
        }
      }
    }
  }
}
{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "Could not find aggregator type [query] in [image_tags]",
        "line": 11,
        "col": 22
      }
    ],
    "type": "parsing_exception",
    "reason": "Could not find aggregator type [query] in [image_tags]",
    "line": 11,
    "col": 22
  },
  "status": 400
}

Hi ! Looking at the doc I think the query field should not be present. Can you try:

{
  "from": 0,
  "size": 0,
  "aggs": {
    "image_tag" : {
      "children": {
        "type": "review"
      },
      "aggs": {
        "image_tags" : {
            "filter": {
              "match_phrase": {
                "user_comment": "hogehoge"
            }
          }
        }
      }
    }
  }
}

Oups! Thanks for help me.
It work!

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