Search code examples
elasticsearchelasticsearch-aggregation

Multi_terms aggregation gives me an error


I'm trying to use ElasticSearch v. 7.11.1 on Windows 10. I don't know how to make multi_terms aggregation work. This query:

{
  "aggs": {
    "test_agg": {
      "multi_terms": {
        "terms": [{
          "field": "JobTitle.keyword" 
        }, {
          "field": "AboutMe.keyword"
        }]
      }
    }
  }
}

gives me this:

{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "Unknown aggregation type [multi_terms] did you mean [rare_terms]?",
        "line": 4,
        "col": 22
      }
    ],
    "type": "parsing_exception",
    "reason": "Unknown aggregation type [multi_terms] did you mean [rare_terms]?",
    "line": 4,
    "col": 22,
    "caused_by": {
      "type": "named_object_not_found_exception",
      "reason": "[4:22] unknown field [multi_terms]"
    }
  },
  "status": 400
}

but this query:

{
  "aggs": {
    "test_agg": {
      "terms": 
            {
                "field": "JobTitle.keyword",
                "size": "10"
            }
    }
  }
}

works. What am I doing wrong ?


Solution

  • The problem is, that you're using Elasticsearch 7.11.

    As you can see in the Release notes, they added the multi_terms feature in 7.12.0.