elasticsearch - 无法从 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
}
}
}
}
}
推荐阅读
- json - 如何序列化地图
> 使用 gson? - javascript - 采用数组并将所有零移动到末尾的方法,保留其他元素的顺序
- javascript - 如何在 TypeScript 中按类型顺序获取值或对象?
- c - 为什么我们在“cc ex1.c -o ex1”编译“exe1.c”文件中的代码时使用“make”命令
- azure - 如何访问 ARM 输出中的迭代值?
- spring-boot - 部署到 Cloud Foundry 的 Spring Boot 的 Logstash 管道模板
- python - 处理带有转义字符的 JSON
- angular - 如何将 Angular @nrwl/nest 应用程序 api 部署到 VM(服务器)?
- c# - 基于 XML C# 中存在的属性将 XML 反序列化为适当的类型
- powerbi - 返回每个组每个帐户的第一个非空白日期 - Power BI