html tool

2018年1月17日星期三

转:es组合查询


https://www.elastic.co/guide/cn/elasticsearch/guide/current/multi-query-strings.html
GET /_search
{
  "query": {
    "bool": {
      "should": [
        { "match": { "title":  "War and Peace" }},
        { "match": { "author": "Leo Tolstoy"   }}
      ]
    }
  }
}
bool 查询采取 more-matches-is-better 匹配越多越好的方式,所以每条 match 语句的评分结果会被加在一起,从而为每个文档提供最终的分数 _score 。能与两条语句同时匹配的文档比只与一条语句匹配的文档得分要高。
[next:还是不太清楚这个查询在get的url中如何使用,参考:https://es.xiaoleilu.com/050_Search/20_Query_string.html 但还是不行]

没有评论:

发表评论