diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java index dd148e8d6d7..383cf959c13 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java @@ -234,33 +234,13 @@ public class PercolatorFieldMapper extends FieldMapper { KeywordFieldMapper queryTermsField, KeywordFieldMapper extractionResultField, BinaryFieldMapper queryBuilderField) { super(simpleName, fieldType, defaultFieldType, indexSettings, multiFields, copyTo); - this.queryShardContext = new QueryShardContextSupplierCache(queryShardContext); + this.queryShardContext = queryShardContext; this.queryTermsField = queryTermsField; this.extractionResultField = extractionResultField; this.queryBuilderField = queryBuilderField; this.mapUnmappedFieldAsString = INDEX_MAP_UNMAPPED_FIELDS_AS_STRING_SETTING.get(indexSettings); } - private static class QueryShardContextSupplierCache implements Supplier { - private final Supplier supplier; - private volatile QueryShardContext context; - - QueryShardContextSupplierCache(Supplier supplier) { - this.supplier = supplier; - } - - @Override - public QueryShardContext get() { - QueryShardContext context = this.context; - if (context == null) { - context = this.context = supplier.get(); - } - // return a copy - return new QueryShardContext(context); - } - - } - @Override public FieldMapper updateFieldType(Map fullNameToFieldType) { PercolatorFieldMapper updated = (PercolatorFieldMapper) super.updateFieldType(fullNameToFieldType);