[英]elasticsearch mapping issue: failed to parse field
我有这个映射
PUT /mytest
{
"mappings":{
"properties": {
"value": { "type": "object" }
}
}
}
当我插入这个文件时
POST /mytest/_doc/4
{
"value": { "value": "test"}
}
我收到以下错误:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [value.value] of type [long] in document with id '4'. Preview of field's value: 'test'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [value.value] of type [long] in document with id '4'. Preview of field's value: 'test'",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "For input string: \"test\""
}
},
"status": 400
}
我知道命名约定很糟糕,但这是一个有效的 JSON 请求,不知道为什么它不允许。
此错误告诉您在值对象属性中没有属性值的映射。 下面的示例将属性设置 mytest 索引中的 value.value 属性:
PUT mytest
{
"mappings": {
"properties": {
"value": {
"type": "object",
"properties": {
"value": {
"type": "text"
}
}
}
}
}
}
但是,我认为这不是您的意图。 作为最佳实践,请尝试按照Elastic Common Schema (ECS)命名索引属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.