我有这样的映射-
"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
}
}
}
}
}
关于elasticsearch - 无法从ES获得任何结果。没有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63731421/