我已经使用显式映射创建索引:
PUT http://192.168.1.71:9200/items
{
"mappings": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"num": {
"type": "long"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
并尝试添加文档:
POST http://192.168.1.71:9200/items/1
{
"num" : 1.898,
"name" : "aaa"
}
Run Code Online (Sandbox Code Playgroud)
但得到错误:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [items] as the final mapping would have more than 1 type: [_doc, 1]"
}
],
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [items] as the final mapping would have more than 1 type: [_doc, 1]"
},
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
为什么以及如何安装它?
您需要在idwhich之前指定文档类型_doc
POST http://192.168.1.71:9200/items/_doc/1
{
"num" : 1.898,
"name" : "aaa"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8052 次 |
| 最近记录: |