如何解决无法从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
}
}
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。