1

Could Elasticsearch Template be used to do index sorting https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-index-sorting.html

1
  • Hi mitz, welcome to stack overflow, please edit your question to include the code you're presently using which is generating the error you've provided. Commented Sep 26, 2019 at 3:07

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

Yes, index sorting is like any other settings and can be specified in an index template:

PUT _template/mytemplate
{
    "index_patterns": ["myindex"],
    "aliases": {},
    "settings" : {
        "index" : {
            "number_of_shards": 2,
            "number_of_replicas": 1,
            "sort.field" : "date", 
            "sort.order" : "desc" 
        }
    },
    "mappings": {
        "properties": {
            "date": {
                "type": "date"
            }
        }
    }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.