1

我有一个看起来像这样的嵌套过滤器:

search = search.filter(
                'nested', 
                path=path, 
                filter=F('bool', must=queries),
                inner_hits={'sort': ['p', 'd']}
            )

我想在整个事情周围添加一个 OR 过滤器。所以它要么匹配 X 要么匹配这个嵌套查询。

我正在使用 ES 1.7

4

1 回答 1

1

多一点的毅力让我得到了这个:

search = search.filter(
                'or',
                [F(
                    'nested',
                    path=path,
                    filter=F('bool', must=queries),
                    inner_hits={'sort': ['p', 'd']}
                ), F('bool', must=or_queries)]
            )

这似乎可以解决问题..

于 2016-05-27T14:29:00.763 回答