【问题标题】:Index sorting Elasticsearch索引排序 Elasticsearch
【发布时间】:2020-01-26 06:14:58
【问题描述】:

【问题讨论】:

  • 嗨,米茨,欢迎来到堆栈溢出,请编辑您的问题以包含您当前使用的代码,该代码会生成您提供的错误。

标签: spring elasticsearch spring-data-elasticsearch elasticsearch-template


【解决方案1】:

我猜你的问题针对的是 Spring Data Elasticsearch,因为你相应地标记了它。

Spring Data Elasticsearch 目前不支持管理索引模板,有a ticket in Jira 支持。

您当然可以在 ES 中手动添加索引模板,如 Val 的答案所示。

【讨论】:

    【解决方案2】:

    是的,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"
                }
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-17
      • 1970-01-01
      • 2016-07-18
      • 2015-02-14
      • 1970-01-01
      • 2021-08-10
      • 1970-01-01
      相关资源
      最近更新 更多