索引排序Elasticsearch

问题描述 投票:0回答:1

可以使用Elasticsearch模板进行索引排序https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-index-sorting.html

spring elasticsearch spring-data-elasticsearch elasticsearch-template
1个回答
0
投票

是,index sorting与其他设置一样,可以在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"
            }
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.