1. 程式人生 > 其它 >Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to t

Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to t

技術標籤:ElasticSearch

完整報錯資訊

(Python3.6) [email protected]:~/桌面/Flink_Code/flink清洗資料案例/FlinkProj$ ./kibana.sh
{"acknowledged":true}{"acknowledged":true,"shards_acknowledged":true,"index":"auditindex"}{
"error" : {
"root_cause" : [

{
"type" : "illegal_argument_exception",
"reason" : "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
}
],
"type" : "illegal_argument_exception",
"reason" : "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
},
"status" : 400
}

解決方案:

url -H "Content-Type: application/json" -XPOST 'http://master:9200/auditindex/audittype/_mapping?pretty' -d '
{
"audittype":{
	"properties":{
		"area":{"type":"keyword"},
		"type":{"type":"keyword"},
		"count":{"type":"long"},
		"time":{"type":"date","format": "yyyy-MM-dd HH:mm:ss"}
		}
    }
}
'

改成

curl -H "Content-Type: application/json" -XPOST 'http://Desktop:9201/auditindex/audittype/_mapping?include_type_name=true' -d '
{
 "audittype":{
    "properties":{
        "area":{"type":"keyword"},
        "type":{"type":"keyword"},
        "count":{"type":"long"},
        "time":{"type":"date","format": "yyyy-MM-dd HH:mm:ss"}
        }
     }
}
'

最終正確的資訊如下:

(Python3.6) [email protected]:~/桌面/Flink_Code/flink清洗資料案例/FlinkProj$ ./kibana.sh
{"acknowledged":true}{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "auditindex"
}

Reference:

[1]elasticsearch7.x遇到的bug彙總