无法从ES获得任何结果.没有错误



我有这样的映射-

"type": "nested",
"include_in_parent": true,
"properties": {
"value": {
"type": "nested",
"properties": {
"Technical": {
"properties": {
"techlocation": {
"type": "string"
},
"techname22": {
"type": "string"
}
}
}
}
}
}
},

当我运行match_all查询时,我得到了这个-

"metadata": [
{
"value": {
"Technical": [
{
"techname22": "test"
},
{
"techlocation": "usa"
}
]
}
}
],

但我无法用(也尝试过Technical.techlocation:(loc((和其他方式查询它。dddddddddd-

"query": {
"filtered": {
"query": {
"query_string" : {
"query": "metadata.value.Technical.techlocation:(loc)",
"default_operator": "AND",
"analyze_wildcard": true
}
}
}
}
}

真的没有什么好说的了。谢谢你的帮助!

您似乎使用的是较旧的ES版本,因此此查询的实际语法可能有所不同,但在nested字段上搜索时需要使用nested查询:

{
"query": {
"nested": {
"path": "metadata.value",
"query": {
"query_string": {
"query": "metadata.value.Technical.techlocation:(usa)",
"default_operator": "AND",
"analyze_wildcard": true
}
}
}
}
}

最新更新