ElasticSearch 7.4.2 Root mapping definition has unsupported parameters

新建索引

PUT people

{
    "settings":{
        "number_of_shards":3,
        "number_of_replicas":1
    },
    "mappings":{
        "man":{
            "properties":{
                "name":{
                    "type":"text"
                },
                "country":{
                    "type":"keyword"
                },
                "age":{
                    "type":"integer"
                },
                "date":{
                    "type":"date",
                    "format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
                }
            }
        }    
    }
}

然后,报错:Root mapping definition has unsupported parameters

查看官网示例后发现 7.4 默认不在支持指定索引类型,默认索引类型是_doc(隐含:include_type_name=false)。见官网:https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html#_typeless_apis_in_7_0

修改:

{
    "settings": {
        "number_of_shards": 3,
        "number_of_replicas": 1
    },
    "mappings": {
        "properties": {
            "name": {
                "type": "text"
            },
            "country": {
                "type": "keyword"
            },
            "age": {
                "type": "integer"
            },
            "date": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
            }
        }
    }
}

 如果你要像之前旧版版本一样兼容自定义 type ,需要将 include_type_name=true 携带, 见官网示例: https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html#_index_templates

PUT localhost:9200/people?include_type_name=true

但是这一字段将在8.x 舍弃

 

posted @ 2019-11-19 13:44  feiquan  阅读(21992)  评论(0编辑  收藏  举报
如果是此文是转载文章,本人会附上转载链接,此篇文章的版权归原创作者所属,如果侵权请与我联系,我会删除此文。

若没有标明转载链接,此篇文章属于本人的原创文章,其版权所属:
作者:feiquan
出处:http://www.cnblogs.com/feiquan/
版权声明:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
大家写文都不容易,请尊重劳动成果~ 这里谢谢大家啦(*/ω\*)