Initialize an ElasticSearch Docker container with predefined indices


We are using the official Docker images for ElasticSearch, and for development purposes, we would like the single node cluster to initialize with predefined indices. Is this possible?
The same way were you put SQL script in a certain location in the MYSQL image, it gets executed.

We can export the mapping via http:<ES_HOST>/<index_name>/_mapping
And use that in the body of a curl command as mentioned here

Thank you

Does anyone have an idea how to approach this issue?

There is nothing built in as far as I know. One way would be to attach a snapshot repository and restore the indices from there. This would however require a number of API calls once the node is up and running.