繁体   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