1
user_profile指數有分支機構映射country_isoElasticsearch排除不帶屬性格式匹配標準
{
"_index": "user_profile",
"_type": "user",
"_id": "188",
"_score": 1.0042034,
"_source": {
"user_id": 188,
"phone": "971550000322",
"profile_set_date": "Apr 6, 2017",
"phone_country": "AE",
"branches": [
{
"id": 27,
"brand_id": 20,
"country_iso": "KW",
"city_iso": "KW-02-145162",
"area_id": 33
},
{
"id": 45,
"brand_id": 56,
"country_iso": "AE",
"city_iso": "AE-01-206944",
"area_id": 18
},
{
"id": 46,
"brand_id": 56,
"country_iso": "AE",
"city_iso": "AE-01-206944",
"area_id": 18
}
],
"prog_id": 13,
"email": "[email protected]"
}
}
我需要找到誰擁有country_iso = AE分支映射用戶和不與任何其他文件
必須和must_not組合沒有爲我工作
{
"query": {
"bool": {
"must": [
{
"match": {
"prog_id": 13
}
}
],
"should": [
{
"nested": {
"path": [
"branches"
],
"query": {
"query_string": {
"fields": [
"branches.country_iso"
],
"query": "AE"
}
}
}
}
],
"minimum_number_should_match": 1,
"must_not": [
{
"bool": {
"must_not": [
{
"nested": {
"path": [
"branches"
],
"query": {
"query_string": {
"fields": [
"branches.country_iso"
],
"query": "AE"
}
}
}
}
]
}
}
]
}
}
}
非常感謝。它似乎是完美的。我會用更多的測試來驗證resutl。 –