Skip to content

Script in terms aggregation that is not a value script should fail with descriptive failure message #11728

Closed as not planned
@brwe

Description

@brwe

When a script is not a value script in a terms aggregation then the request must not contain the "fields" parameter.
However, there is no warning to the user if the request has the "fields" parameter anyway. The aggregation will just fail with cryptic error messages or even worse just silently not do the right thing.

This fails with an ArrayIndexOutOfBoundsException:

{
  "aggs": {
    "2": {
      "terms": {
        "field": "label",
        "script": "doc['label'].value"
      }
    }
  }
}

This silently just does not do the right thing (returns one bucket with key 0 and all docs in it):

{
  "aggs": {
    "2": {
      "terms": {
        "field": "label",
        "script": "_index['text']['the'].tf()"
      }
    }
  }
}

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