Geo-shape queries on PrefixTree geo shapes cannot be executed when – How to solve this OpenSearch exception

Opster Team

Aug-23, Version: 1-1.1

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your OpenSearch operation.

Briefly, this error occurs when you try to execute geo shape queries on PrefixTree geo shapes, but the ‘ignore_malformed’ setting is set to true. This setting is designed to ignore malformed geo shapes, but it can interfere with geo shape queries. To resolve this issue, you can either set ‘ignore_malformed’ to false or switch to using BKD-backed geo shapes, which support ‘ignore_malformed’ being set to true. Additionally, ensure that your geo shapes are correctly formed to avoid triggering the ‘ignore_malformed’ setting.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” [geo-shape] queries on [PrefixTree geo shapes] cannot be executed when ‘ ” to appear. To understand the issues related to this log, read the explanation below about the following OpenSearch concepts: index, query.

Log Context

Log “[geo-shape] queries on [PrefixTree geo shapes] cannot be executed when ‘” class name is We extracted the following from OpenSearch source code for those seeking an in-depth context :

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


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Get expert answers on Elasticsearch/OpenSearch