2015-11-03 89 views
0

嗨,我想Elasticsearch排除結果

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

所以我用布爾像

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

排除結果誰擁有內的兩個值,但不工作,你可以幫助我

編輯:在清除我想排除結果有類型=='doc'AND stat UT ==「無效」

+0

嗨,你的標題是真的不清楚,什麼是「不能,如果和」是什麼意思?您使用當前代碼看到的結果是什麼? –

+0

編輯是否更清楚? –

+0

是的!不過,很抱歉我沒有登錄很長時間。很高興你能找到你自己的答案,而且你把它提供給其他人! –

回答

1

我發現

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