Loading templates/mapping when initializing a elasticsearch server?


I have a project consisting of 3 maven modules, one for specification, one for data node and one for master.
The data module consist of a config directory with elasticsearch.yml. This is as well included for the master module.

First when I googled for how to set a default mapping I found the documentation for an old version 1,6

Where it was possible to package the server including template files.

This does not seem to be possible in 2.4, Is there any other way how I should handle this?

The only alternative way to do this as I understand it:

  • start elasticsearch server
  • make a (curl) PUT request with a setting for the index or a template
  • index my document

Or is there another good way? And why doesn't it seem to be possible to have this in the configuration?

1 Like