php - Elasticsearch排除结果

标签 php elasticsearch elastica

嗨,我想排除两个值内的结果

喜欢

if ($type == 'doc' && $statut == 'inactive') 
            return false;

所以我用 bool(boolean) 像
$filter ['bool'] ['should'] ['bool'] ['must_not'][] = array (
        'term' => array (
                'type' => "doc"
        ),
        'term' => array (
                'statut' => "inactive"
        )
);

但是那行不通,你能帮我吗

编辑:显然我想排除结果具有类型=='doc'AND statut =='inactive'

最佳答案

我发现

$filter ['bool'] ['must_not'] []  = array(
    'bool' => array(
        'must' => array(
            array('term' => array('type' => "doc" )),
            array('term' => array('statut' => "inactive")),
            ) 
        ) 
    );

关于php - Elasticsearch排除结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33500946/

相关文章:

php - 从一个表中选择匹配值到另一个表中的多个值

php - 如果您在防火墙后面的 NAT 上,您如何使用 php xdebug?

php - 多个连接无法识别选项 "mapping_types"

Elasticsearch 按部分日期过滤

elasticsearch - 在 Elastica 中过滤全局聚合

php - MySQL 查询与习语和日期问题

elasticsearch - 带有多种语言的ES NGram

elasticsearch - Kibana 4现成的仪表板?

elasticsearch - Elastica-多个 bool 查询-子查询

php - 通过Elasticsearch根据领域获得独特的结果