Can only use wildcard queries on keyword; text and wildcard fields – not on – How to solve this Elasticsearch error

Can only use wildcard queries on keyword; text and wildcard fields – not on – How to solve this Elasticsearch error

Opster Team

February-21, Version: 1.7-8.0

To understand why Elasticsearch can only use wilcard queries on keyword, text and wildcard fields, we recommend you run the Elasticsearch Error Check-Up which can help you resolve this issue. It’s a free tool that requires no installation and analyzes your cluster on the spot.

This guide will help you check for common problems that cause the log “Can only use wildcard queries on keyword; text and wildcard fields – not on” to appear. It’s important to understand the related issues, so to get started, read the general overview on indices in Elasticsearch.

Log Context

Log”Can only use wildcard queries on keyword; text and wildcard fields – not on [“classname  is MappedFieldType.java We extracted the following from Elasticsearch source code for those seeking an in-depth context :

}
 
  public Query wildcardQuery(String value;
  @Nullable MultiTermQuery.RewriteMethod method;
  QueryShardContext context) {
  throw new QueryShardException(context; "Can only use wildcard queries on keyword; text and wildcard fields - not on [" + name
  + "] which is of type [" + typeName() + "]");
  }
 
  public Query regexpQuery(String value; int flags; int maxDeterminizedStates; @Nullable MultiTermQuery.RewriteMethod method;
  QueryShardContext context) {

 

Run the Check-Up to get a customized report like this:

Analyze your cluster