我想进行嵌套过滤。但是返回错误。还有其他过滤方法吗?使用这个真的吗?
/ models / series / filter_season方法:
def self.filter_season
s = Tire.search('myindex', type: 'series') do
query do
filtered do
query do
all
end
filter do
nested do
path 'seasons'
query do
bool do
must do
term 'seasons.title', 'season 5'
end
end
end
end
end
end
end
end
s.results.each do|result|
puts result.title
end
端
映射设置:
index_name 'myindex'
mapping do
indexes :id, type: 'integer'
indexes :title, type: 'string'
indexes :seasons, type: 'nested' do
indexes :id, type: 'integer'
indexes :title, type: 'string'
end
end
答案 0 :(得分:1)
请在Nested query with filters test integration
问题上查看以下答案 filter
方法需要至少一个参数,在你的情况下,它接收0。因此,错误。
希望本文有助于解决您的问题。