Skip to content

Option to remove key_as_string from aggregation response #63898

Open
@wylieconlon

Description

@wylieconlon

Formatted keys are not always needed when the original value is used by client code, but are always returned. If there were an option to remove the formatted values then we could reduce the total response size of ES queries by going from this type of response:

{
  ...
  "aggregations": {
    "sales_over_time": {
      "buckets": [
        {
          "key_as_string": "2015-01-01",
          "key": 1420070400000,
          "doc_count": 3
        },

to this:

{
  ...
  "aggregations": {
    "sales_over_time": {
      "buckets": [
        {
          "key": 1420070400000,
          "doc_count": 3
        },

One option that would be nice would be to have a parameter called "include_formatted": false on the date histogram and other aggregations that return formatted keys.

There are existing workarounds, but both workarounds have issues:

  • Using REST response filtering to remove the keys. This has issues because of a bug in response filtering.
  • Setting the format to a special character like _ will reduce some of the response size, but the response will still contain "key_as_string": "_" instead of being removed.

cc @polyfractal

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