索引排序 Elasticsearch
Index sorting Elasticsearch
Elasticsearch Template可以用来做索引排序吗
https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-index-sorting.html
是的,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"
}
}
}
}
我猜你的问题针对的是 Spring Data Elasticsearch,因为你相应地标记了它。
Spring Data Elasticsearch 目前不支持管理索引模板,a ticket in Jira 支持。
您当然可以在 ES 中手动添加索引模板,如 Val 的回答所示。
Elasticsearch Template可以用来做索引排序吗 https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-index-sorting.html
是的,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"
}
}
}
}
我猜你的问题针对的是 Spring Data Elasticsearch,因为你相应地标记了它。
Spring Data Elasticsearch 目前不支持管理索引模板,a ticket in Jira 支持。
您当然可以在 ES 中手动添加索引模板,如 Val 的回答所示。