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
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_stringparameter from date histogram responses by setting this parameter:_search?filter_path=*,-**.key_as_stringOther 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_logsdataset:Example query: