我正在嘗試從索引中獲取所有城市為空的記錄。
來源看起來像:
"_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我收到不同型別錯誤的來源時。
must_not exists 回傳包含非空城市的來源。
我嘗試了不同型別的腳本來過濾資料但沒有結果。
_mapping 請求,城市有嵌套型別。
"cities": {
"type": "nested",
"properties": {
請指教
uj5u.com熱心網友回復:
exists您是否以嵌套方式撰寫查詢?
{
"query": {
"bool" : {
"must_not": [
"nested": {
"path": "cities",
"query": {
"exists": {
"field": "cities"
}
}
} ]
}
}
}
基于此discussion
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/444278.html
上一篇:使用聚合過濾器創建陣列
下一篇:查詢中的外包零件
