📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 7.7-7.15

简而言之,当您尝试在PrefixTree地理形状上执行geo-shape查询而’geo_shape’字段被禁用时,会发生此错误。该字段对于执行geo-shape查询至关重要。要解决此问题,您可以在Elasticsearch索引设置中启用’geo_shape’字段。或者,如果您的用例不需要’geo_shape’字段,可以修改查询以避免在PrefixTree地理形状上使用geo-shape查询。

日志上下文 #

日志"[geo-shape] queries on [PrefixTree geo shapes] cannot be executed when ‘“的类名是 LegacyGeoShapeQueryProcessor.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:

}  public Query geoShapeQuery(Geometry shape; String fieldName; SpatialStrategy strategy;
 ShapeRelation relation; SearchExecutionContext context) {
 if (context.allowExpensiveQueries() == false) {
 throw new ElasticsearchException("[geo-shape] queries on [PrefixTree geo shapes] cannot be executed when '"
 + ALLOW_EXPENSIVE_QUERIES.getKey() + "' is set to false.");
 }  SpatialStrategy spatialStrategy = shapeFieldType.strategy();
 if (strategy != null) {