elasticsearch复杂搜索

发布时间:2020-05-26 14:39:39 阅读:1103次
➜  elasticsearch cat query.sh
curl -XPOST http://192.168.2.143:9200/poems/poem/_search/ -d '
{
    "query": {
        "bool": {
            "must": {
                "bool" : { "should": [                    

                      { "match": { "title": "静夜思" }},

                      { "match": { "content": "故人" }}

                ] }
            },
            "must": { "term": { "cat_id": 1 }}
        }
    }

}'

类似

select *from poems where cat_id=1 and (title like '%静夜思%' or content like '%故人%');

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:elasticsearch复杂搜索 出自老鄢博客 | 欢迎分享