Use logstash mapping for all future indicies

Hello there,

Is there a way to assign the mapping for the logstash index to all future indices created? I can create indices super easy, but having to define each field is a little time consuming, and so far, I have found the default one for logstash to be universally useful and time efficient :smiley: If I name my index "logstash-windowsevents" then the mapping for the logstash-* index works just fine, but I would like the data in a whole new index if possible.

Many thanks

Logstash uses a template -

So you can take that and modify how you wish :slight_smile:

Thanks, but I don't quite follow what you're saying. I do not see anything in Elasticsearch as to what template the logstash index is using. I do not wish to modify anything at all at this point in time. I want to use the exact mapping for the logstash index for all indices. Maybe there is something being said that I am not picking up or something. I'm 99% sure it's me :laughing:

Did you check out the _template API? That'll give you an idea of what's happening.

You will need to modify things if you want it for all indices. If you look at that link from earlier you will see the index_patterns declarative, that is where it knows what index patterns to apply the mappings to. Which is what you're trying to do :slight_smile:

Ah ok that makes a little more sense. Thank you for putting that into perspective. I was able to get some info from

curl -XGET localhost:9200/_template

but I cannot seem to find how to edit an existing template.

Completly spitballing it here, but I tried this

curl -XPUT localhost:9200/_template/logstash -d '
"template": "*"

That changed everything in the template instead of just changing what I intended. The only thing left is


while the original had a bunch of stuff. I think I was able to fix that part by copying the original GET request and pasting that into the curl. The only thing I changed was the "template" section form "logstash-*" to just "*". I think it will work lol I will post back when I check on some data.

curl -XGET localhost:9200/_template

You are better off giving things specific names, cause if you restart/upgrade Logstash then it'll overwrite that template anyway.

Ah ok well I thought I had an easy solution :smile: I will create other templates and copy/paste the mapping from the logstash index. This should get me by until I get more exp with Elasticsearch. Thank you for putting all of this into a better perspective for me.

1 Like

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