Skip to content

[data.search.aggs] Aggs should exclude the key_as_string parameter from date histogram responses #80720

@wylieconlon

Description

@wylieconlon

We can reduce the JSON payload that Kibana needs by approximately 50% by using response filtering parameters. Specifically, we should be removing the key_as_string parameter from date histogram responses by setting this parameter:

_search?filter_path=*,-**.key_as_string

Other than the recent use of key_as_string in TSVB, and some use in tests, it appears that this is completely unused because we are using moment.js to do date formatting.

Example response sizes on the kibana_sample_data_logs dataset:

Request type Size without filtering Size with filter
Date histogram with daily buckets 4.9kB 2.42kB (-51%)
Top geo.dest with 3-hour date histogram, showing sum of bytes 478.93kB 278.81kB (-41.77%)

Example query:

curl -u elastic -X POST http://localhost:9200/kibana_sample_data_logs/_search?filter_path=*,-**.key_as_string -H 'Content-Type: application/json' -d '{
  "size": 0,
  "aggs": {
    "destinations": {
      "terms": {
        "field": "geo.dest"
      },
      "aggs": {
        "dates": {
          "date_histogram": {
            "field": "@timestamp",
            "fixed_interval": "3h"
          },
          "aggs": {
            "total": {
              "sum": {
                "field": "bytes"
              }
            }
          }
        }
      }
    }
  }
}' | wc -c

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:AggregationsAggregation infrastructure (AggConfig, esaggs, ...)enhancementNew value added to drive a business resultimpact:lowAddressing this issue will have a low level of impact on the quality/strength of our product.loe:smallSmall Level of Effortperformance

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions