2016-11-16 9 views
0

通常は複数のオブジェクトを含む 'bundles'というネストされたオブジェクトがあります。このクエリを使用すると、バンドル内のオブジェクトのIDを問合せることはできますが、複数のIDを問い合せることはできません。提案?ネストされた弾性検索2クエリの複数の値

{ 
 
    "query": { 
 
    "nested": { 
 
     "path": "bundles", 
 
     "query": { 
 
     "bool": { 
 
      "must": [ 
 
      { 
 
       "match": { 
 
       "bundles.id": 43273 
 
       } 
 
      } 
 
      ] 
 
     } 
 
     }, 
 
     "inner_hits": {} 
 
    } 
 
    } 
 
}

答えて

0

おそらく、あなたは "すべきである" ではなく、ブールフィルタに "しなければならない" としたいです。例:

{ 
    "query": { 
    "nested": { 
     "path": "bundles", 
     "query": { 
     "bool": { 
      "should": [ 
      { 
       "match": { 
       "bundles.id": 43273 
       }, 
       { 
       "match": { 
       "bundles.id": 433373 
       } 
      } 
      ] 
     } 
     } 
    } 
    } 
} 

フィールドを正確に照合することもできます。例:

{ 
    "query": { 
    "nested": { 
     "path": "bundles", 
     "query": { 
     "bool": { 
      "must": [ 
      { 
       "terms": { 
       "bundles.id": [1140000000, 114] 
       } 
      } 
      ] 
     } 
     } 
    } 
    } 
}' 
関連する問題