es(elasticsearch) 实现 and 和 or 查询,举个例子。
实现 "name"=="a" and ("city" == "b" or "city" == "c")
es DSL 查询如下:
{
    "query": {
        "bool": {
            "must": [{
                "match_phrase": {
                    "name": "a"
                }
            }],
            "should": [{
                "match_phrase": {
                    "city": "b"
                }
            },
            {
                "match_phrase": {
                    "city": "c"
                }
            }],
            "minimum_should_match": 1
        }
    },
    "size": 5 //获取 5 条记录
}