s = Search(index='test-index').using(client)
q = Q('percolate',
field="query",
documents=list_of_documents)
s = s.query(q)
p = s.execute()
我试图对一个索引和一个文档列表运行一个渗透查询,我得到了错误
RequestError(400, 'search_phase_execution_exception', 'Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters.').
非常感谢您对解决此问题的任何帮助
我将通过API开始解释这一点
Percolate query可用于匹配存储在索引中的查询
使用Percolate字段创建索引时,可以指定如下映射:
这表示字段
message
将是用于Percolate查询的字段如果要匹配文档列表,则应发送带有此字段的术语列表,如example found in the docs:
说到这里,你应该:
在ES索引中设置适当的映射以过滤特定字段
在DSL中,仅发送带有“Percolated”字段的参数列表,而不是整个ES文档
希望这是有帮助的:D
相关问题 更多 >
编程相关推荐