I was wondering if it's possible to start up Elasticsearch with index templates applied (for example by being defined in a config).
We currently have a pod that has Elastic and Logstash containers, and the Logstash pipeline applies the index templates at startup.
But, sometimes, for some reason, the ES container in the pod restarts. Logstash doesn't re-apply the template (since Logstash keeps running), pushes updates (and thus creating the index with an invalid mapping) and we would get errors on our backend that certain nested fields aren't present (that are defined in the template).
We would like to move to a solution where ES itself applies the index template before being available, for robustness reasons.
We thought about applying the templates in the ES container itself at startup by calling the relevant REST endpoints, but then Logstash would still be able to push data, possibly when the index template hasn't been applied yet. Setting a readiness probe on Kubernetes level doesn't matter since both containers are running in the same pod.
Is this possible? Are there any alternative solutions?