[英]indexing json with json value in elasticsearch
我正在嘗試在Elasticsearch中索引文檔。 我擁有的json來自將文檔從XML轉換為JSON的文檔。 這是有效的JSON。 看起來像這樣:
{
"shortcasename": {
"_attributes": {
"party1": "People",
"party2": "Johnson"
},
"_children": [
"People",
{
"connector": {
"_attributes": {
"normval": "v"
},
"_children": [
" v. "
]
}
},
"Johnson"
]
}
}
Elasitcsearch的shortcasename._children似乎有問題。 我得到的錯誤是:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "mapper [shortcasename._children] of different type, current_type [string], merged_type [ObjectMapper]"
}
},
"status": 400
}
有沒有辦法讓json像以前那樣被索引?
您擁有的JSON與_children
字段沖突:
{
"shortcasename": {
"_attributes": {
"party1": "People",
"party2": "Johnson"
},
"_children": [
"People",
{
"connector": {
"_attributes": {
"normval": "v"
},
"_children": [
" v. "
]
}
},
"Johnson"
]
}
}
頂級_children
字段是一個數組,包含對象( {"connector": ...}
)和字符串( "People"
,“ Johnson"
)的混合。 Elasticsearch不支持該功能,這就是為什么它抱怨無法合並string
和Object
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.