版本: 7.7-7.15
简要来说,当在没有映射类型的 Elasticsearch 索引上尝试执行 percolate 查询时,会发生此错误。Percolate 查询用于测试文档是否匹配查询的条件。要解决此问题,您可以为索引创建映射类型,或者使用已经具有映射类型的其他索引。另外,如果您只是想从索引中检索所有文档,可以使用 match_all 查询代替 percolate 查询。
日志上下文 #
日志 “[percolate] queries cannot be executed when ‘” 的类名是 PercolateQueryBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:
} @Override
protected Query doToQuery(SearchExecutionContext context) throws IOException {
if (context.allowExpensiveQueries() == false) {
throw new ElasticsearchException("[percolate] queries cannot be executed when '" +
ALLOW_EXPENSIVE_QUERIES.getKey() + "' is set to false.");
} // Call nowInMillis() so that this query becomes un-cacheable since we
// can't be sure that it doesn't use now or scripts





