接12节

5)、multi_match 【多字段匹配】

举例:state 或 address 包含 mill

GET /bank/_search
{
   
     
  "query": {
   
     
    "multi_match": {
   
     
      "query": "mill",
      "fields": ["address","state"]
    }
  }
}

 

多字段查询的时候也会进行分词查询,得分最高的在前面:

GET /bank/_search
{
   
     
  "query": {
   
     
    "multi_match": {
   
     
      "query": "mill movico",
      "fields": ["address","city"]
    }
  }
}