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 舍弃

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM