【发布时间】:2016-10-25 21:54:21
【问题描述】:
我正在尝试在 elasticsearch 聚合上创建一个类似 here 的 Rails 应用程序。我更新了它以使用当前的 elasticsearch 2.3。 javascript 运行良好,但当我选择多个复选框时,过滤器不返回任何内容。与不处理复选框的应用程序 here 不同的代码。我错过了什么?
过滤器看起来像这样:
__set_filters = lambda do |key, f|
@search_definition[:post_filter][:and] ||= []
@search_definition[:post_filter][:and] |= [f]
@search_definition[:aggregations][key.to_sym][:filter][:bool][:must] ||= []
@search_definition[:aggregations][key.to_sym][:filter][:bool][:must] |= [f]
end
if options[:category]
f = { term: { "categories,name" => options[:category] } }
__set_filters.(:location, f)
end
if options[:location]
f = { term: { "location,name" => options[:location] } }
__set_filters.(:categories, f)
end
【问题讨论】:
-
举一个类别名称的例子。是他们的空间吗?你用过标准分析仪吗?
标签: ruby-on-rails elasticsearch aggregation