[英]How to add an OR filter around a nested query with elasticsearch-dsl
我有一个看起来像这样的嵌套过滤器:
search = search.filter(
'nested',
path=path,
filter=F('bool', must=queries),
inner_hits={'sort': ['p', 'd']}
)
我想在整个事情周围添加一个 OR 过滤器。 所以它要么匹配 X 要么匹配这个嵌套查询。
我正在使用 ES 1.7
多一点的毅力让我得到了这个:
search = search.filter(
'or',
[F(
'nested',
path=path,
filter=F('bool', must=queries),
inner_hits={'sort': ['p', 'd']}
), F('bool', must=or_queries)]
)
这似乎可以解决问题..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.