其他分享
首页 > 其他分享> > ES基础(二十) 单字符串多字段查询:Dis Max Query

ES基础(二十) 单字符串多字段查询:Dis Max Query

作者:互联网

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PUT /blogs/_doc/1
{
    "title": "Quick brown rabbits",
    "body":  "Brown rabbits are commonly seen."
}

PUT /blogs/_doc/2
{
    "title": "Keeping pets healthy",
    "body":  "My quick brown fox eats rabbits on a regular basis."
}

POST /blogs/_search
{
    "query": {
        "bool": {
            "should": [
                { "match": { "title": "Brown fox" }},
                { "match": { "body":  "Brown fox" }}
            ]
        }
    }
}

POST blogs/_search
{
    "query": {
        "dis_max": {
            "queries": [
                { "match": { "title": "Quick pets" }},
                { "match": { "body":  "Quick pets" }}
            ]
        }
    }
}


POST blogs/_search
{
    "query": {
        "dis_max": {
            "queries": [
                { "match": { "title": "Quick pets" }},
                { "match": { "body":  "Quick pets" }}
            ],
            "tie_breaker": 0.2
        }
    }
}

 

标签:body,title,Max,blogs,pets,Quick,Query,多字段,match
来源: https://www.cnblogs.com/qiu-hua/p/14196883.html