簡體   English   中英

elasticsearch中的術語查詢

[英]Terms query in elasticsearch

術語和術語集查詢有什么區別? 我如何在 term 參數中對查詢進行 OR 查詢?

例如:

GET /_serarch
{
    "Query":{
        "term":{"user":"kimchy"},{"Age": 25}
    }
}

術語集查詢您可以提供一組術語以匹配文檔中的任何術語。

GET /my-index/_search
{
   "query": {
      "terms_set": {
          "codes" : {
              "terms" : ["abc", "def", "ghi"],
              "minimum_should_match_field": "required_matches"
          }
      }
   }
}

術語查詢查找包含指定術語的文檔。

POST _search
{
  "query": {
  "term" : { "user" : "Kimchy" } 
  }
}

您可以使用 bool 查詢執行 OR。

"query": {
  "bool" : {     
    "should" : [
      { "term" : { "tag" : "wow" } },
      { "term" : { "tag" : "elasticsearch" } }
    ],
    "minimum_should_match" : 1,
  }
}

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM