elasticsearch in语句和not in语句

sql语句示例:

select * from table where t_id in (1,2,3,4)

 

 php代码示例:

            $search_query = [
                "bool" => [
                    "must" => [
                        ["term" => ["type" => 'thread']],
                        ["range" => ["id" => ['lte' => $top_tid]]]//gte
                    ],

                    // in
                    /*
                    "filter" => [
                        "terms" => ["fid" => [43, 44]],
                    ],
                    */

                    // not in

                    "must_not" => [
                        "terms" => ["fid" => [44]],
                    ],

                ],
            ];

 

posted on 2018-03-20 10:04  dongruiha  阅读(4852)  评论(0编辑  收藏  举报

导航