简体   繁体   English

在ElasticSearch中,如何搜索大量关键字

[英]In ElasticSearch, how to search for a large list of keywords

I have built the below query in python with ElasticSearch library loaded.我在 python 中构建了以下查询,并加载了 ElasticSearch 库。 I'd like to keep expanding the list below so I can find the corresponding data for the ones within the list.我想继续扩展下面的列表,以便在列表中找到相应的数据。
How do I pass the "list" into the ElasticSearch query so later I can just keep expanding the "list" once I need to add more (like hundreds) into my search list?如何将“列表”传递到 ElasticSearch 查询中,以便稍后我需要在搜索列表中添加更多(如数百个)时继续扩展“列表”?

list = ["123","234","456"]

query_all = {
           "query": {
                    "bool":{
                           "must":[
                                  {"match": {"orderData.orderId.id.keyword" : list}},                                    
                                  ]
                            }
                     }
              }

Probably you are looking for terms query可能您正在寻找术语查询

{
  "query": {
    "bool": {
      "must": [
        {
          "terms": {
            "orderData.orderId.id.keyword": list
          }
        }
      ]
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM