Percolate queries cannot be executed when – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.7-7.15

Briefly, this error occurs when a percolate query is attempted on an Elasticsearch index that doesn’t have a mapping type. Percolate queries are used to test if a document matches the conditions of a query. To resolve this issue, you can either create a mapping type for the index or use a different index that already has a mapping type. Alternatively, you can use a match_all query instead of a percolate query if you simply want to retrieve all documents from the index.

This guide will help you check for common problems that cause the log ” [percolate] queries cannot be executed when ‘ ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: percolator.

Log Context

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

 }  @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


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?