我正在尝试使用ElasticSearch执行搜索,该搜索必须匹配部分索引中的某些搜索项,但仅适用于属于某些项目的部分,即当前用户可以访问的项目.
所以我试图将一个过滤器应用于查询,以便它过滤那些将project_id包含在一小组2或3个不同值中的部分.如果某个部分的project_id属于有效的project_id,则应该包含它.否则它不会.
这都是使用elasticsearch-model gem的rails api的上下文.
这是我传入的查询.它假装过滤部分,因此只有项目2和5中的部分包含在结果中.
{ "query": { "filtered": { "query": { "multi_match": { "query": "search terms here", "type": "cross_fields", "fields": ["title^3", "contents"], "operator": "and" } }, "filter": { "or": { "filters": [ { "exists": { "project_id": 2 } }, { "exists": { "project_id": 5 } } ] } } } } }
我收到这个错误:
QueryParsingException[[sections] [exists] filter does not support [project_id]]
有任何想法吗?