我有以下查詢來創建索引:
curl -X PUT "http://localhost:9200/my-index-000002?pretty" -H 'Content-Type: application/json' -d'
{
"mappings": {
"athlete": {
"properties": {
"birthdate": {
"type": "date",
"format": "dateOptionalTime"
},
"location": {
"type": "geo_point"
},
"name": {
"type": "string"
},
"rating": {
"type": "integer"
},
"sport": {
"type": "string"
}
}
}
}
}'
我收到以下錯誤:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [athlete : {properties={birthdate={format=dateOptionalTime, type=date}, name={type=string}, rating={type=integer}, location={type=geo_point}, sport={type=string}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [athlete : {properties={birthdate={format=dateOptionalTime, type=date}, name={type=string}, rating={type=integer}, location={type=geo_point}, sport= {type=string}}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [athlete : {properties={birthdate={format=dateOptionalTime, type=date}, name={type=string}, rating={type=integer}, location={type=geo_point}, sport={type=string}}}]"
}
},
"status": 400
}
我認為我創建索引的語法不正確。感謝任何見解。謝謝
uj5u.com熱心網友回復:
只需洗掉,athlete因為不再需要任何映射型別名稱,其余的就可以了:
curl -X PUT "http://localhost:9200/my-index-000002?pretty" -H 'Content-Type: application/json' -d'
{
"mappings": {
<---- remove this line
"properties": {
"birthdate": {
"type": "date",
"format": "dateOptionalTime"
},
"location": {
"type": "geo_point"
},
"name": {
"type": "string"
},
"rating": {
"type": "integer"
},
"sport": {
"type": "string"
}
}
}
}'
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/365804.html
標籤:弹性搜索
