码迷,mamicode.com
首页 > 其他好文 > 详细

es实现and与or查询

时间:2019-10-16 13:32:29      阅读:928      评论:0      收藏:0      [点我收藏+]

标签:bool   class   col   style   imu   ini   phrase   pre   minimum   

{
    "query": {
        "bool": {
            "must": [{
                "match_phrase": {
                    "name": "a"
                }
            }],
            "should": [{
                "match_phrase": {
                    "city": "b"
                }
            },
            {
                "match_phrase": {
                    "city": "c"
                }
            }],
            "minimum_should_match": 1
        }
    },
    "size": 5
}

实现 "name"=="a" and ("city" == "b" or "city" == "c")

es实现and与or查询

标签:bool   class   col   style   imu   ini   phrase   pre   minimum   

原文地址:https://www.cnblogs.com/AlanWilliamWalker/p/11684550.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!