diff --git a/server/src/main/java/org/elasticsearch/index/query/InterceptedQueryBuilderWrapper.java b/server/src/main/java/org/elasticsearch/index/query/InterceptedQueryBuilderWrapper.java index 97901a55bcc03..7f263cabf9ab5 100644 --- a/server/src/main/java/org/elasticsearch/index/query/InterceptedQueryBuilderWrapper.java +++ b/server/src/main/java/org/elasticsearch/index/query/InterceptedQueryBuilderWrapper.java @@ -35,6 +35,7 @@ class InterceptedQueryBuilderWrapper implements QueryBuilder { public QueryBuilder rewrite(QueryRewriteContext queryRewriteContext) throws IOException { QueryRewriteInterceptor queryRewriteInterceptor = queryRewriteContext.getQueryRewriteInterceptor(); try { + queryRewriteContext.setQueryRewriteInterceptor(null); QueryBuilder rewritten = queryBuilder.rewrite(queryRewriteContext); if (rewritten != queryBuilder) { return new InterceptedQueryBuilderWrapper(rewritten);