簡體   English   中英

ElasticSearch遍歷一組

[英]ElasticSearch percolate over a set

Tire gem的DSL示例中給出了以下代碼。

index = Tire.index('weather') do
  delete
  create

  # First, a query named _warning_,
  register_percolator_query('warning', :tags => ['warning']) { string 'warning OR severe OR extreme' }

  # a query named _tsunami_,
  register_percolator_query('tsunami', :tags => ['tsunami']) { string 'tsunami' }
end


matches = index.percolate(:message => '[Warning] Extreme flooding expected after tsunami wave.')

我想知道如何將匹配條件設置為一組術語而不是ORed字符串。

例如, string 'warning weather OR severe weather OR extreme weather'將匹配warningweather而不是同時warning weather兩個warning weather

我正在研究ElasticSearch,因為我會很快使用它,但是我還沒有使用它,因此我可以嘗試分享我的薄知識:)

請檢查其文檔http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query/

並查看default_operator設置,我想您需要將其設置為AND

暫無
暫無

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

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