目前有用到的用法如下:

 1 post /index_name/_search
 2 {
 3   "query" : {
 4     "match_phrase": {
 5       "nickname": {
 6         "query": "nihao ma",
 7         "slop" : 0
 8       }
 9     }
10   },
11   "size" : 10,
12   "from" : 0
13 }

通过from+size来实现分页,但是有个限制,from+size不能超过index.max_result_window。

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html

slop参数其实就是你允许你输入的词里面中间还能隔着几个词。也就是说,slop=0就是只能按你输入的词来搜索。slop=1,比如输入是“ni ma", 那么结果里可能就包含"ni ba ma"。

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html

 

相关文章:

  • 2022-12-23
  • 2021-08-29
  • 2021-09-13
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
猜你喜欢
  • 2021-06-29
  • 2022-12-23
  • 2022-02-13
  • 2022-02-16
  • 2022-01-19
  • 2021-05-06
  • 2022-12-23
相关资源
相似解决方案