我尝试将帖子_bulk发布到弹性搜索中,但它会抛出:
{
"took": 1,
"errors": true,
"items": [
{
"index": {
"_index": "quick",
"_type": "parts",
"_id": "ACI250-2016",
"status": 400,
"error": {
"type": "mapper_parsing_exception",
"reason": "failed to parse [part]",
"caused_by": {
"type": "number_format_exception",
"reason": "For input string: \"250-2016\""
}
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
这就是我要发布的内容:
POST _bulk
{"index":{"_index":"quick","_type":"parts","_id":"ACI250-2016"}}
{"eMfg":"ACI","part":"250-2016"}
Run Code Online (Sandbox Code Playgroud)
而地图是:
{
"quick": {
"mappings": {
"parts": {
"properties": {
"app": {
"type": "string"
},
"eMfg": {
"type": "string"
},
"fPart": {
"type": "long"
},
"oPart": {
"type": "string"
},
"ofPart": {
"type": "string"
},
"part": {
"type": "long"
},
"price": {
"type": "double"
},
"title": {
"type": "string"
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
根据你的映射,part有类型long,你正在尝试发送"250-2016".原因可能是您在某个时刻发送了一个文档,其中一个部分对一个数字具有强制性,例如"250",现在您正在尝试发送一个字符串,但它失败了.
最好的方法是使用上面的映射来定义具有正确映射类型的新索引(见下文),然后您可以再次尝试批量导入.
DELETE /quick
PUT /quick
{
"mappings": {
"parts": {
"properties": {
"app": {
"type": "string"
},
"eMfg": {
"type": "string"
},
"fPart": {
"type": "long"
},
"oPart": {
"type": "string"
},
"ofPart": {
"type": "string"
},
"part": {
"type": "string" <-- change this
},
"price": {
"type": "double"
},
"title": {
"type": "string"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9719 次 |
| 最近记录: |