问题描述
我的索引映射如下:
{
"mapping": {
"properties": {
"MyMapProperty": {
"type": "nested",
"properties": {
"first": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"second": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
}
},
"SecondProperty": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ThirdProperty": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"Timestamp": {
"type": "date"
}
}
}
}
添加新文档后,其来源如下所示:
After new document added, it source looks like below:
{
"_index": "indexName",
"_type": "_doc",
"_id": "idlklkm43rgre",
"_version": 1,
"_score": 0,
"_source": {
"MyMapProperty": {
"first": "value1",
"second": "value2",
},
"SecondProperty": "value3",
"ThirdProperty": "value4",
},
"fields": {
"Timestamp": [
"2020-05-11T12:54:49.049Z"
]
}
}
因此我很高兴在Kibana中看到可用的字段: MyMapProperty.fist | MyMapProperty.second |第二属性| ThirdProperty
So acltually I see in Kibana available fields:MyMapProperty.fist | MyMapProperty.second |SecondProperty | ThirdProperty
问题是,当我尝试搜索MyMapProperty.fist:value时-什么都找不到...但是,如果我将搜索SecondProperty:value3-则返回结果.
Problem is that when I am trying to search MyMapProperty.fist : value - it finds nothing... However if I will search SecondProperty : value3 - it returns result.
我试图了解我做错了什么,是kibana问题还是弹性搜索,或者我正在执行一些奇怪的操作.你能告诉我吗...
I am trying to understand what I did wrong, is it kibana problem or elastic search, or maybe I am performing some strange actions. Could you please advise...
推荐答案
解决方案是从"MyMapProperty"的索引定义中删除类型.
The solution was to remove type from index definition for "MyMapProperty".
"type": "nested"
之后,嵌套属性变为可搜索...
After that nested attributes became searchable...
这篇关于麋鹿.找不到嵌套的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!