Expose the bitset filter cache in the MappingParserContext (#109298)

Add the bitset filter cache in the MappingParserContext
This commit is contained in:
Jim Ferenczi 2024-06-05 11:43:07 +01:00 committed by GitHub
parent 32dfd1866e
commit 564549af8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 119 additions and 24 deletions

View file

@ -9,6 +9,7 @@
package org.elasticsearch.benchmark.index.mapper;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.util.Accountable;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.cluster.ClusterModule;
import org.elasticsearch.cluster.metadata.IndexMetadata;
@ -21,10 +22,12 @@ import org.elasticsearch.index.analysis.AnalyzerScope;
import org.elasticsearch.index.analysis.IndexAnalyzers;
import org.elasticsearch.index.analysis.LowercaseNormalizer;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
import org.elasticsearch.index.mapper.MapperMetrics;
import org.elasticsearch.index.mapper.MapperRegistry;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.ProvidedIdFieldMapper;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.indices.IndicesModule;
import org.elasticsearch.script.Script;
@ -52,6 +55,13 @@ public class MapperServiceFactory {
MapperRegistry mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
SimilarityService similarityService = new SimilarityService(indexSettings, null, Map.of());
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetFilterCache.Listener() {
@Override
public void onCache(ShardId shardId, Accountable accountable) {}
@Override
public void onRemoval(ShardId shardId, Accountable accountable) {}
});
MapperService mapperService = new MapperService(
() -> TransportVersion.current(),
indexSettings,
@ -73,6 +83,7 @@ public class MapperServiceFactory {
throw new UnsupportedOperationException();
}
},
bitsetFilterCache::getBitSetProducer,
MapperMetrics.NOOP
);

View file

@ -189,6 +189,7 @@ public class QueryParserHelperBenchmark {
throw new UnsupportedOperationException();
}
},
query -> { throw new UnsupportedOperationException(); },
MapperMetrics.NOOP
);