你可以使用
"execution":"and"你的条件过滤器是这样的:
{ "filter": { "bool": { "must": [ { "terms": { "ip": [ "192.168.0.1", "10.0.0.9" ], "execution": "and" } } ] } }}这是我用来测试的一些代码:
http://sense.qbox.io/gist/d6b5f4e4c0d2977a04b1795f4bbb0503f6365dfe
编辑: 嵌套的版本(我误解了问题)。
假设您的索引是按照我设置我的测试对象的方式设置的,那么该查询应该为您提供所需的信息(请参见下面的代码)。列表中需要包含两个
nested子句,
must因为我们要查找的文档包含两个不同的嵌套文档,每个嵌套IP。
POST /test_index/_search{ "filter": { "bool": { "must": [ { "nested": { "path": "ips", "filter": { "term": { "ip": "192.168.0.1" } } } }, { "nested": { "path": "ips", "filter": { "term": { "ip": "10.0.0.9" } } } } ] } }}这是我用来设置的代码:
http://sense.qbox.io/gist/cd3a0ec61cb1348d5cc2bd1ef444f4898f6d8e57



