如何查询所有嵌套字段为空的数据?弹性搜索 v.7
我正在尝试从索引中获取城市为空的所有记录。
源看起来像:
"_index": "potatos_index",
"_type": "_doc",
"_id": "1240862",
"_score": 14.41736,
"_source": {
"accountNumber": "1121212",
"accountType": "Customer",
"currency": "USD",
"country": "USA",
"cities": null,
}
"_index": "potatos_index",
"_type": "_doc",
"_id": "1240862",
"_score": 14.41736,
"_source": {
"accountNumber": "1121212",
"accountType": "Customer",
"currency": "USD",
"country": "USA",
"cities": [
{
"id": "1111",
"globalId": "1111"
}],
}
因此,当我尝试仅搜索那些具有 cities: null
的源时,我收到不同类型的错误。
必须不+存在返回包含非空城市的源。
我尝试过不同类型的脚本来过滤数据,但没有结果。
_mapping 请求,城市具有嵌套类型。
"cities": {
"type": "nested",
"properties": {
请指教
I'm trying to get all records from index that has cities as null.
Source looks like:
"_index": "potatos_index",
"_type": "_doc",
"_id": "1240862",
"_score": 14.41736,
"_source": {
"accountNumber": "1121212",
"accountType": "Customer",
"currency": "USD",
"country": "USA",
"cities": null,
}
"_index": "potatos_index",
"_type": "_doc",
"_id": "1240862",
"_score": 14.41736,
"_source": {
"accountNumber": "1121212",
"accountType": "Customer",
"currency": "USD",
"country": "USA",
"cities": [
{
"id": "1111",
"globalId": "1111"
}],
}
So when I try to search only those source that has cities: null
I receive different kinds of errors.
must_not + exists returns sources that contains non-null cities.
I have tried different kind of script to filter out the data but no result.
_mapping request, cities has type nested.
"cities": {
"type": "nested",
"properties": {
Please advice
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否以嵌套方式编写了
exists
查询?基于此 <代码>讨论
Did you write the
exists
query in nested manner?Based on this
discussion