1. 程式人生 > >elasticsearch學習之通過設定搜尋邊界實現精確匹配欄位

elasticsearch學習之通過設定搜尋邊界實現精確匹配欄位

GET tmdb/_search
{
  "_source": "name_exact_match", 
  "query": {
    "bool": {
      "should": [
        {
          "constant_score": {
            "filter": {
              "match_phrase":{
                 "name_exact_match": "SENTINEL_BEGIN patrick stewart  SENTINEL_END"
              }
            },
            "boost": 1000
          }
        }
      ]
    }
  }
}
GET tmdb/_search
{
  "_source": "title", 
  "query": {
    "function_score": {
      "query": {
        "constant_score": {
          "filter": {
            "match_phrase":{
              "name_exact_match": "SENTINEL_BEGIN patrick stewart  SENTINEL_END"
            }
          },
          "boost": 1.2
        }
      },
      "functions": [
        {
          "gauss": {
            "release_date": {
              "origin": "now",
              "scale": "5500d",
              "decay": 0.5
            }
          }
        },
        {
          "field_value_factor": {
            "field": "vote_average",
            "modifier": "sqrt"
          }
        }
      ]
    }
  }
}