【发布时间】:2018-07-08 15:07:50
【问题描述】:
我正在使用 Elastica,我需要创建一个过滤器来获取 NULL 值以及低于 100 的值。
目前我的代码如下所示:
$this->filter = $qb->query()->bool();
$this->filter->addShould($qb->query()->range('price', ['lte' => 100]));
它返回 price 低于 100 的数据。 我还需要获取具有 null 值的数据。 到目前为止,我尝试过:
$this->filter->addMustNot($qb->query()->exists('price')); // returns 0 items
$this->filter->addShould($qb->query()->missing('price')); // doesn't work. Gives undefined query "missing" in Facade.php
有人可以帮我解决这个问题吗?或者如何解决未定义查询“丢失”的问题或创建另一个适合我需要的过滤器。谢谢。
【问题讨论】:
标签: php elasticsearch elastica