Reputation: 14250
I'd like to visualize how our average elasticsearch document size is changing over time.
_size
field on my index. ref_size: <900
curl -H 'Content-Type: application/json' -s http://es.example.com/logstash-2019.10.17/_search -d '{"query": {"range": {"_size": { "lt": 900 }}}}' | jq .
Now I want to create a Kibana visualization, for example a date histogram with the median _size
, but Kibana "Visualize" won't let me select _size
as the aggregation field. Is there a way to visualize the size of documents?
_size is a "meta-field".
_size
The size of the_source
field in bytes, provided by the mapper-size plugin.
Maybe "meta fields" aren't supported in Kibana?
I can aggregate by _size
when not using Kibana "Visualize":
curl -H 'Content-Type: application/json' -s http://es.example.com/logstash-2019.10.17/_search -d '{
"query": {
"range": {
"_size": {
"gt": 10
}
}
},
"aggs": {
"sizes": {
"terms": {
"field": "_size",
"size": 10
}
}
},
"sort": [
{
"_size": {
"order": "desc"
}
}
]
}' | jq .
Upvotes: 1
Views: 1845
Reputation: 46
Question is old but looks not answered. The solution is:
Now the _size value should be available as any other (_source) field at your Kibana visualizations/dashboards etc.
Upvotes: 3
Reputation: 2083
If you go in Kibana to Management
->Elasticsearch index management
you can see for specific index that:
Some fields does not have Aggretable
on.
Check other fields and see that they have circle in this column.
And that's the reason why Kibana Visualize
won't let you select _size
as the aggregation field
.
Maybe you could use https://www.elastic.co/guide/en/kibana/current/scripted-fields.html
somehow to make it work by making additional field, if Kibana
would allow you to use _size
field inside of a script and that field would be Aggretable
in a sense i mentioned earlier.
Upvotes: 2