Elasticsearch同时实现and与or查询

 

{
    "query": {
        "bool": {
            "must": [{
                "match_phrase": {
                    "type_id": 123
                }
            }],
            "should": [{
                "match_phrase": {
                    "title": "常德"
                }
            },
            {
                "match_phrase": {
                    "content": "常德"
                }
            }],
            "minimum_should_match": 1
        }
    },
    "size": 5
}

 

posted @ 2023-03-06 16:55  赵瑛  阅读(136)  评论(0编辑  收藏  举报

版权所有 © 2022 沅来是澧

如果有程序开发、网站建设等需求的请联系我,QQ:47419233