Could Elasticsearch Template be used to do index sorting https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-index-sorting.html
I guess that your question targets Spring Data Elasticsearch as you tagged it correspondingly.
Spring Data Elasticsearch currently does not support managing index templates, theres is a ticket in Jira to support this.
You can of course add the index templates manually in ES like shown in Val's answer.