multi_match 的 minimum_should_match

 

minimum_should_match only be used in multi_match in

It can be written:

{
   "Query" : {
         "multi_match" : {
           "Query": "Zheng Xu Huang Bo Shen Teng hot pot" ,
           "Fields": [ "title" ],
           "minimum_should_match":. 4 
        } 
    } 
}

Represents hit four words of the document will be returned

Also can be written:

{
   "Query" : {
         "multi_match" : {
           "Query": "Zheng Xu Huang Bo Shen Teng hot pot" ,
           "Fields": [ "title" ],
           "minimum_should_match": "80%" 
        } 
    } 
}

80% 80% here refers to the number of the query word

Our adjustment to the word interface to see the results:

{
    "tokens": [
        {
            "token": "徐峥",
            "start_offset": 0,
            "end_offset": 2,
            "type": "CN_WORD",
            "position": 0
        },
        {
            "token": "沈腾",
            "start_offset": 2,
            "end_offset": 4,
            "type": "CN_WORD",
            "position": 1
        },
        {
            "token": "黄渤",
            "start_offset": 4,
            "end_offset": 6,
            "type": "CN_WORD",
            "position": 2
        },
        {
            "token": "吃火锅",
            "start_offset": 6,
            "end_offset": 9,
            "type": "CN_WORD",
            "position": 3
        }
    ]
}

query word is divided into four, so minimum_should_match : " 80% " here is equal  minimum_should_match : . 4 * 0.8 .

Also note, the small value here will be rounded down, is hit three words will be returned.

 

Guess you like

Origin www.cnblogs.com/feng07/p/11571152.html