How to add _size mapping to index template in elasticsearch?

Hi friends

I have installed size mapping plugin and I added it to Kibana meta fields too

I could successfully enable "_size" in Elasticsearch via bellow command and see the result in kibana

PUT logstash-2023-06-06
{
  "mappings": {
    "_size": {
      "enabled": true
    }
  }
} 

but I could just enable size field in a single upcoming index, how to enable _size mapping in all of my upcoming indices and index template?
should I add it in Kibana index template or elasticsearch?

You need to create an index template which matches the index names you will create in the future.

ok I know that
but how this must be added to template?
I don't know this is not a text or Boolean type

Something like this should work I think:

PUT _index_template/logstash-size
{
  "index_patterns": ["logstash-*"],
  "template": {
    "mappings": {
      "_size": {
        "enabled": true
      }
    }
  },
  "priority": 500
}
3 Likes

Note that this applies only to new indices.

Thanks it worked
Is the document size by byte or kb?

I believe this is in bytes but I'm not sure.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.