Skip to content

SQL: COUNT(DISTINCT [field_name]) generates "Two sibling aggregations cannot have the same name" error #30287

@astefan

Description

@astefan

Test index mapping with no documents:

PUT ip_index2
{
  "mappings": {
    "_doc": {
      "properties": {
        "source": {
          "type":"text",
          "fields": {
            "keyword": {
              "type":"keyword"
            }
          }
        },
        "country": {
          "type": "keyword"
        }
      }
    }
  }
}

The following query select source,count(distinct country) from ip_index2 group by source having count(distinct country)>5 generates an error:

Server error [Server sent bad type [illegal_argument_exception]. Original type was [Two sibling aggregations cannot have the same name: [1777]]. [java.lang.IllegalArgumentException: Two sibling aggregations cannot have the same name: [1777]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions