现在我写了
Tire.search INDEX_NAME do
query do
filtered do
query { string term }
filter :or, { missing: { field: :app_id } },
{ terms: { app_id: app_ids } }
end
end
end.results.to_a
答案 0 :(得分:1)
返回没有app_id的项目或与您的条款匹配的项目听起来像是一个或过滤器的工作 - 我会尝试
filter :or, [
{:not => {:exists => {:field => :app_id}}},
{:terms => {:app_id => app_ids}}
]