Wildcard queries 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 attempt to run a wildcard query on a field that is not analyzed. OpenSearch requires fields to be analyzed to perform wildcard queries. To resolve this issue, you can either change the mapping of the field to be analyzed or use a keyword field for wildcard queries. Alternatively, you can use the “query_string” query which automatically analyzes the field. However, be cautious as these changes can have significant impacts on performance and relevance of search results.

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 ” [wildcard] queries cannot be executed when ‘ ” to appear. To understand the issues related to this log, read the explanation below about the following OpenSearch concepts: index.

Log Context

Log “[wildcard] queries cannot be executed when ‘” class name is StringFieldType.java. We extracted the following from OpenSearch source code for those seeking an in-depth context :

 @Override
 public Query wildcardQuery(String value; MultiTermQuery.RewriteMethod method; boolean caseInsensitive; QueryShardContext context) {
 failIfNotIndexed();
 if (context.allowExpensiveQueries() == false) {
 throw new OpenSearchException("[wildcard] queries cannot be executed when '" +
 ALLOW_EXPENSIVE_QUERIES.getKey() + "' is set to false.");
 }  Term term;
 if (getTextSearchInfo().getSearchAnalyzer() != null) {

 

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