ElasticSearch的使用总结

一、ElasticSearch中执行词语查询(不分词)

使用  match_phrase
{
  "query": {
    "filtered": {
       "filter": {
           "or": {
              "filters": [
                 {
                     "query": {
                         "match_phrase": {
                            "myField1": "My first search phrase"
                         }
                     }
                 },
                 {
                     "query": {
                         "match_phrase": {
                            "myField1": "My second search phrase"
                         }
                     }
                 },
                 {
                     "query": {
                         "match_phrase": {
                            "myField1": "My third search phrase"
                         }
                     }
                 }
              ]
           }
       }
    }
  }
}

执行多个“match”或“match_phrase”值

 {
      "query": {
        "query_string": {
          "default_field": "myField1",
          "query": "\"My first search phrase\" OR \"My second search phrase\" OR \"My third search phrase\""
        }
      }
    }

一、elasticsearch设置最大返回条数

ElasticSearch的使用总结_第1张图片

参考博客:

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax

你可能感兴趣的:(ElasticSearch的使用总结)