mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Expose the bitset filter cache in the MappingParserContext (#109298)
Add the bitset filter cache in the MappingParserContext
This commit is contained in:
parent
32dfd1866e
commit
564549af8f
18 changed files with 119 additions and 24 deletions
|
@ -9,6 +9,7 @@
|
||||||
package org.elasticsearch.benchmark.index.mapper;
|
package org.elasticsearch.benchmark.index.mapper;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||||
|
import org.apache.lucene.util.Accountable;
|
||||||
import org.elasticsearch.TransportVersion;
|
import org.elasticsearch.TransportVersion;
|
||||||
import org.elasticsearch.cluster.ClusterModule;
|
import org.elasticsearch.cluster.ClusterModule;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
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.IndexAnalyzers;
|
||||||
import org.elasticsearch.index.analysis.LowercaseNormalizer;
|
import org.elasticsearch.index.analysis.LowercaseNormalizer;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
import org.elasticsearch.index.mapper.MapperMetrics;
|
import org.elasticsearch.index.mapper.MapperMetrics;
|
||||||
import org.elasticsearch.index.mapper.MapperRegistry;
|
import org.elasticsearch.index.mapper.MapperRegistry;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
import org.elasticsearch.index.mapper.ProvidedIdFieldMapper;
|
import org.elasticsearch.index.mapper.ProvidedIdFieldMapper;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.index.similarity.SimilarityService;
|
import org.elasticsearch.index.similarity.SimilarityService;
|
||||||
import org.elasticsearch.indices.IndicesModule;
|
import org.elasticsearch.indices.IndicesModule;
|
||||||
import org.elasticsearch.script.Script;
|
import org.elasticsearch.script.Script;
|
||||||
|
@ -52,6 +55,13 @@ public class MapperServiceFactory {
|
||||||
MapperRegistry mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
|
MapperRegistry mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
|
||||||
|
|
||||||
SimilarityService similarityService = new SimilarityService(indexSettings, null, Map.of());
|
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(
|
MapperService mapperService = new MapperService(
|
||||||
() -> TransportVersion.current(),
|
() -> TransportVersion.current(),
|
||||||
indexSettings,
|
indexSettings,
|
||||||
|
@ -73,6 +83,7 @@ public class MapperServiceFactory {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
bitsetFilterCache::getBitSetProducer,
|
||||||
MapperMetrics.NOOP
|
MapperMetrics.NOOP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,7 @@ public class QueryParserHelperBenchmark {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
query -> { throw new UnsupportedOperationException(); },
|
||||||
MapperMetrics.NOOP
|
MapperMetrics.NOOP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,9 @@ public class IndexMetadataVerifier {
|
||||||
() -> null,
|
() -> null,
|
||||||
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
scriptService,
|
scriptService,
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException("IndexMetadataVerifier");
|
||||||
|
},
|
||||||
mapperMetrics
|
mapperMetrics
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -652,6 +652,9 @@ public final class IndexModule {
|
||||||
},
|
},
|
||||||
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
scriptService,
|
scriptService,
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException("no index query shard context available");
|
||||||
|
},
|
||||||
mapperMetrics
|
mapperMetrics
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,6 +212,7 @@ public class IndexService extends AbstractIndexComponent implements IndicesClust
|
||||||
this.indexAnalyzers = indexAnalyzers;
|
this.indexAnalyzers = indexAnalyzers;
|
||||||
if (needsMapperService(indexSettings, indexCreationContext)) {
|
if (needsMapperService(indexSettings, indexCreationContext)) {
|
||||||
assert indexAnalyzers != null;
|
assert indexAnalyzers != null;
|
||||||
|
this.bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetCacheListener(this));
|
||||||
this.mapperService = new MapperService(
|
this.mapperService = new MapperService(
|
||||||
clusterService,
|
clusterService,
|
||||||
indexSettings,
|
indexSettings,
|
||||||
|
@ -223,6 +224,7 @@ public class IndexService extends AbstractIndexComponent implements IndicesClust
|
||||||
() -> newSearchExecutionContext(0, 0, null, System::currentTimeMillis, null, emptyMap()),
|
() -> newSearchExecutionContext(0, 0, null, System::currentTimeMillis, null, emptyMap()),
|
||||||
idFieldMapper,
|
idFieldMapper,
|
||||||
scriptService,
|
scriptService,
|
||||||
|
bitsetFilterCache::getBitSetProducer,
|
||||||
mapperMetrics
|
mapperMetrics
|
||||||
);
|
);
|
||||||
this.indexFieldData = new IndexFieldDataService(indexSettings, indicesFieldDataCache, circuitBreakerService);
|
this.indexFieldData = new IndexFieldDataService(indexSettings, indicesFieldDataCache, circuitBreakerService);
|
||||||
|
@ -238,7 +240,6 @@ public class IndexService extends AbstractIndexComponent implements IndicesClust
|
||||||
this.indexSortSupplier = () -> null;
|
this.indexSortSupplier = () -> null;
|
||||||
}
|
}
|
||||||
indexFieldData.setListener(new FieldDataCacheListener(this));
|
indexFieldData.setListener(new FieldDataCacheListener(this));
|
||||||
this.bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetCacheListener(this));
|
|
||||||
this.warmer = new IndexWarmer(threadPool, indexFieldData, bitsetFilterCache.createListener(threadPool));
|
this.warmer = new IndexWarmer(threadPool, indexFieldData, bitsetFilterCache.createListener(threadPool));
|
||||||
this.indexCache = new IndexCache(queryCache, bitsetFilterCache);
|
this.indexCache = new IndexCache(queryCache, bitsetFilterCache);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
package org.elasticsearch.index.mapper;
|
package org.elasticsearch.index.mapper;
|
||||||
|
|
||||||
|
import org.apache.lucene.search.Query;
|
||||||
|
import org.apache.lucene.search.join.BitSetProducer;
|
||||||
import org.elasticsearch.TransportVersion;
|
import org.elasticsearch.TransportVersion;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||||
import org.elasticsearch.cluster.metadata.MappingMetadata;
|
import org.elasticsearch.cluster.metadata.MappingMetadata;
|
||||||
|
@ -167,6 +169,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
||||||
Supplier<SearchExecutionContext> searchExecutionContextSupplier,
|
Supplier<SearchExecutionContext> searchExecutionContextSupplier,
|
||||||
IdFieldMapper idFieldMapper,
|
IdFieldMapper idFieldMapper,
|
||||||
ScriptCompiler scriptCompiler,
|
ScriptCompiler scriptCompiler,
|
||||||
|
Function<Query, BitSetProducer> bitSetProducer,
|
||||||
MapperMetrics mapperMetrics
|
MapperMetrics mapperMetrics
|
||||||
) {
|
) {
|
||||||
this(
|
this(
|
||||||
|
@ -179,6 +182,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
||||||
searchExecutionContextSupplier,
|
searchExecutionContextSupplier,
|
||||||
idFieldMapper,
|
idFieldMapper,
|
||||||
scriptCompiler,
|
scriptCompiler,
|
||||||
|
bitSetProducer,
|
||||||
mapperMetrics
|
mapperMetrics
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -194,6 +198,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
||||||
Supplier<SearchExecutionContext> searchExecutionContextSupplier,
|
Supplier<SearchExecutionContext> searchExecutionContextSupplier,
|
||||||
IdFieldMapper idFieldMapper,
|
IdFieldMapper idFieldMapper,
|
||||||
ScriptCompiler scriptCompiler,
|
ScriptCompiler scriptCompiler,
|
||||||
|
Function<Query, BitSetProducer> bitSetProducer,
|
||||||
MapperMetrics mapperMetrics
|
MapperMetrics mapperMetrics
|
||||||
) {
|
) {
|
||||||
super(indexSettings);
|
super(indexSettings);
|
||||||
|
@ -210,7 +215,8 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
||||||
scriptCompiler,
|
scriptCompiler,
|
||||||
indexAnalyzers,
|
indexAnalyzers,
|
||||||
indexSettings,
|
indexSettings,
|
||||||
idFieldMapper
|
idFieldMapper,
|
||||||
|
bitSetProducer
|
||||||
);
|
);
|
||||||
this.documentParser = new DocumentParser(parserConfiguration, this.mappingParserContextSupplier.get());
|
this.documentParser = new DocumentParser(parserConfiguration, this.mappingParserContextSupplier.get());
|
||||||
Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers = mapperRegistry.getMetadataMapperParsers(
|
Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers = mapperRegistry.getMetadataMapperParsers(
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
package org.elasticsearch.index.mapper;
|
package org.elasticsearch.index.mapper;
|
||||||
|
|
||||||
|
import org.apache.lucene.search.Query;
|
||||||
|
import org.apache.lucene.search.join.BitSetProducer;
|
||||||
import org.elasticsearch.TransportVersion;
|
import org.elasticsearch.TransportVersion;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.time.DateFormatter;
|
import org.elasticsearch.common.time.DateFormatter;
|
||||||
|
@ -37,6 +39,7 @@ public class MappingParserContext {
|
||||||
private final IndexAnalyzers indexAnalyzers;
|
private final IndexAnalyzers indexAnalyzers;
|
||||||
private final IndexSettings indexSettings;
|
private final IndexSettings indexSettings;
|
||||||
private final IdFieldMapper idFieldMapper;
|
private final IdFieldMapper idFieldMapper;
|
||||||
|
private final Function<Query, BitSetProducer> bitSetProducer;
|
||||||
private final long mappingObjectDepthLimit;
|
private final long mappingObjectDepthLimit;
|
||||||
private long mappingObjectDepth = 0;
|
private long mappingObjectDepth = 0;
|
||||||
|
|
||||||
|
@ -50,7 +53,8 @@ public class MappingParserContext {
|
||||||
ScriptCompiler scriptCompiler,
|
ScriptCompiler scriptCompiler,
|
||||||
IndexAnalyzers indexAnalyzers,
|
IndexAnalyzers indexAnalyzers,
|
||||||
IndexSettings indexSettings,
|
IndexSettings indexSettings,
|
||||||
IdFieldMapper idFieldMapper
|
IdFieldMapper idFieldMapper,
|
||||||
|
Function<Query, BitSetProducer> bitSetProducer
|
||||||
) {
|
) {
|
||||||
this.similarityLookupService = similarityLookupService;
|
this.similarityLookupService = similarityLookupService;
|
||||||
this.typeParsers = typeParsers;
|
this.typeParsers = typeParsers;
|
||||||
|
@ -63,6 +67,7 @@ public class MappingParserContext {
|
||||||
this.indexSettings = indexSettings;
|
this.indexSettings = indexSettings;
|
||||||
this.idFieldMapper = idFieldMapper;
|
this.idFieldMapper = idFieldMapper;
|
||||||
this.mappingObjectDepthLimit = indexSettings.getMappingDepthLimit();
|
this.mappingObjectDepthLimit = indexSettings.getMappingDepthLimit();
|
||||||
|
this.bitSetProducer = bitSetProducer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexAnalyzers getIndexAnalyzers() {
|
public IndexAnalyzers getIndexAnalyzers() {
|
||||||
|
@ -132,6 +137,10 @@ public class MappingParserContext {
|
||||||
return scriptCompiler;
|
return scriptCompiler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BitSetProducer bitSetProducer(Query query) {
|
||||||
|
return bitSetProducer.apply(query);
|
||||||
|
}
|
||||||
|
|
||||||
void incrementMappingObjectDepth() throws MapperParsingException {
|
void incrementMappingObjectDepth() throws MapperParsingException {
|
||||||
mappingObjectDepth++;
|
mappingObjectDepth++;
|
||||||
if (mappingObjectDepth > mappingObjectDepthLimit) {
|
if (mappingObjectDepth > mappingObjectDepthLimit) {
|
||||||
|
@ -159,7 +168,8 @@ public class MappingParserContext {
|
||||||
in.scriptCompiler,
|
in.scriptCompiler,
|
||||||
in.indexAnalyzers,
|
in.indexAnalyzers,
|
||||||
in.indexSettings,
|
in.indexSettings,
|
||||||
in.idFieldMapper
|
in.idFieldMapper,
|
||||||
|
in.bitSetProducer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +198,8 @@ public class MappingParserContext {
|
||||||
in.scriptCompiler,
|
in.scriptCompiler,
|
||||||
in.indexAnalyzers,
|
in.indexAnalyzers,
|
||||||
in.indexSettings,
|
in.indexSettings,
|
||||||
in.idFieldMapper
|
in.idFieldMapper,
|
||||||
|
in.bitSetProducer
|
||||||
);
|
);
|
||||||
this.dateFormatter = dateFormatter;
|
this.dateFormatter = dateFormatter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,18 @@ import org.apache.lucene.index.DirectoryReader;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs;
|
import org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs;
|
||||||
|
import org.apache.lucene.util.Accountable;
|
||||||
import org.elasticsearch.TransportVersion;
|
import org.elasticsearch.TransportVersion;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.util.BigArrays;
|
import org.elasticsearch.common.util.BigArrays;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.IndexSettings;
|
import org.elasticsearch.index.IndexSettings;
|
||||||
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
||||||
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
import org.elasticsearch.index.mapper.MapperMetrics;
|
import org.elasticsearch.index.mapper.MapperMetrics;
|
||||||
import org.elasticsearch.index.mapper.MapperRegistry;
|
import org.elasticsearch.index.mapper.MapperRegistry;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.index.similarity.SimilarityService;
|
import org.elasticsearch.index.similarity.SimilarityService;
|
||||||
import org.elasticsearch.plugins.MapperPlugin;
|
import org.elasticsearch.plugins.MapperPlugin;
|
||||||
import org.elasticsearch.script.ScriptCompiler;
|
import org.elasticsearch.script.ScriptCompiler;
|
||||||
|
@ -107,6 +110,13 @@ public class CodecTests extends ESTestCase {
|
||||||
Collections.emptyMap(),
|
Collections.emptyMap(),
|
||||||
MapperPlugin.NOOP_FIELD_FILTER
|
MapperPlugin.NOOP_FIELD_FILTER
|
||||||
);
|
);
|
||||||
|
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(settings, new BitsetFilterCache.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onCache(ShardId shardId, Accountable accountable) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoval(ShardId shardId, Accountable accountable) {}
|
||||||
|
});
|
||||||
MapperService service = new MapperService(
|
MapperService service = new MapperService(
|
||||||
() -> TransportVersion.current(),
|
() -> TransportVersion.current(),
|
||||||
settings,
|
settings,
|
||||||
|
@ -117,6 +127,7 @@ public class CodecTests extends ESTestCase {
|
||||||
() -> null,
|
() -> null,
|
||||||
settings.getMode().idFieldMapperWithoutFieldData(),
|
settings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
|
bitsetFilterCache::getBitSetProducer,
|
||||||
MapperMetrics.NOOP
|
MapperMetrics.NOOP
|
||||||
);
|
);
|
||||||
return new CodecService(service, BigArrays.NON_RECYCLING_INSTANCE);
|
return new CodecService(service, BigArrays.NON_RECYCLING_INSTANCE);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.index.mapper;
|
package org.elasticsearch.index.mapper;
|
||||||
|
|
||||||
|
import org.apache.lucene.util.Accountable;
|
||||||
import org.elasticsearch.TransportVersion;
|
import org.elasticsearch.TransportVersion;
|
||||||
import org.elasticsearch.TransportVersions;
|
import org.elasticsearch.TransportVersions;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
|
@ -17,6 +18,8 @@ import org.elasticsearch.index.IndexSettings;
|
||||||
import org.elasticsearch.index.IndexVersion;
|
import org.elasticsearch.index.IndexVersion;
|
||||||
import org.elasticsearch.index.IndexVersions;
|
import org.elasticsearch.index.IndexVersions;
|
||||||
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
||||||
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.index.similarity.SimilarityService;
|
import org.elasticsearch.index.similarity.SimilarityService;
|
||||||
import org.elasticsearch.indices.IndicesModule;
|
import org.elasticsearch.indices.IndicesModule;
|
||||||
import org.elasticsearch.script.ScriptService;
|
import org.elasticsearch.script.ScriptService;
|
||||||
|
@ -43,6 +46,13 @@ public class MappingParserTests extends MapperServiceTestCase {
|
||||||
IndexAnalyzers indexAnalyzers = createIndexAnalyzers();
|
IndexAnalyzers indexAnalyzers = createIndexAnalyzers();
|
||||||
SimilarityService similarityService = new SimilarityService(indexSettings, scriptService, Collections.emptyMap());
|
SimilarityService similarityService = new SimilarityService(indexSettings, scriptService, Collections.emptyMap());
|
||||||
MapperRegistry mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
|
MapperRegistry mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
|
||||||
|
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetFilterCache.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onCache(ShardId shardId, Accountable accountable) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoval(ShardId shardId, Accountable accountable) {}
|
||||||
|
});
|
||||||
Supplier<MappingParserContext> mappingParserContextSupplier = () -> new MappingParserContext(
|
Supplier<MappingParserContext> mappingParserContextSupplier = () -> new MappingParserContext(
|
||||||
similarityService::getSimilarity,
|
similarityService::getSimilarity,
|
||||||
type -> mapperRegistry.getMapperParser(type, indexSettings.getIndexVersionCreated()),
|
type -> mapperRegistry.getMapperParser(type, indexSettings.getIndexVersionCreated()),
|
||||||
|
@ -55,7 +65,8 @@ public class MappingParserTests extends MapperServiceTestCase {
|
||||||
scriptService,
|
scriptService,
|
||||||
indexAnalyzers,
|
indexAnalyzers,
|
||||||
indexSettings,
|
indexSettings,
|
||||||
indexSettings.getMode().idFieldMapperWithoutFieldData()
|
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
|
bitsetFilterCache::getBitSetProducer
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers = mapperRegistry.getMetadataMapperParsers(
|
Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers = mapperRegistry.getMetadataMapperParsers(
|
||||||
|
|
|
@ -277,7 +277,10 @@ public class ParametrizedMapperTests extends MapperServiceTestCase {
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
mapperService.getIndexAnalyzers(),
|
mapperService.getIndexAnalyzers(),
|
||||||
mapperService.getIndexSettings(),
|
mapperService.getIndexSettings(),
|
||||||
mapperService.getIndexSettings().getMode().idFieldMapperWithoutFieldData()
|
mapperService.getIndexSettings().getMode().idFieldMapperWithoutFieldData(),
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
);
|
);
|
||||||
if (fromDynamicTemplate) {
|
if (fromDynamicTemplate) {
|
||||||
pc = pc.createDynamicTemplateContext(null);
|
pc = pc.createDynamicTemplateContext(null);
|
||||||
|
|
|
@ -97,7 +97,10 @@ public class TypeParsersTests extends ESTestCase {
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
mapperService.getIndexAnalyzers(),
|
mapperService.getIndexAnalyzers(),
|
||||||
mapperService.getIndexSettings(),
|
mapperService.getIndexSettings(),
|
||||||
ProvidedIdFieldMapper.NO_FIELD_DATA
|
ProvidedIdFieldMapper.NO_FIELD_DATA,
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
TextFieldMapper.PARSER.parse("some-field", fieldNode, olderContext);
|
TextFieldMapper.PARSER.parse("some-field", fieldNode, olderContext);
|
||||||
|
@ -128,7 +131,10 @@ public class TypeParsersTests extends ESTestCase {
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
mapperService.getIndexAnalyzers(),
|
mapperService.getIndexAnalyzers(),
|
||||||
mapperService.getIndexSettings(),
|
mapperService.getIndexSettings(),
|
||||||
ProvidedIdFieldMapper.NO_FIELD_DATA
|
ProvidedIdFieldMapper.NO_FIELD_DATA,
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
|
|
|
@ -548,7 +548,10 @@ public class SearchExecutionContextTests extends ESTestCase {
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
indexAnalyzers,
|
indexAnalyzers,
|
||||||
indexSettings,
|
indexSettings,
|
||||||
indexSettings.getMode().buildIdFieldMapper(() -> true)
|
indexSettings.getMode().buildIdFieldMapper(() -> true),
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
when(mapperService.isMultiField(anyString())).then(
|
when(mapperService.isMultiField(anyString())).then(
|
||||||
|
|
|
@ -8,15 +8,18 @@
|
||||||
|
|
||||||
package org.elasticsearch.index;
|
package org.elasticsearch.index;
|
||||||
|
|
||||||
|
import org.apache.lucene.util.Accountable;
|
||||||
import org.elasticsearch.TransportVersion;
|
import org.elasticsearch.TransportVersion;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
||||||
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
||||||
import org.elasticsearch.index.mapper.MapperMetrics;
|
import org.elasticsearch.index.mapper.MapperMetrics;
|
||||||
import org.elasticsearch.index.mapper.MapperRegistry;
|
import org.elasticsearch.index.mapper.MapperRegistry;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.index.similarity.SimilarityService;
|
import org.elasticsearch.index.similarity.SimilarityService;
|
||||||
import org.elasticsearch.indices.IndicesModule;
|
import org.elasticsearch.indices.IndicesModule;
|
||||||
import org.elasticsearch.script.ScriptCompiler;
|
import org.elasticsearch.script.ScriptCompiler;
|
||||||
|
@ -58,6 +61,13 @@ public class MapperTestUtils {
|
||||||
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(indexName, finalSettings);
|
IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(indexName, finalSettings);
|
||||||
IndexAnalyzers indexAnalyzers = createTestAnalysis(indexSettings, finalSettings).indexAnalyzers;
|
IndexAnalyzers indexAnalyzers = createTestAnalysis(indexSettings, finalSettings).indexAnalyzers;
|
||||||
SimilarityService similarityService = new SimilarityService(indexSettings, null, Collections.emptyMap());
|
SimilarityService similarityService = new SimilarityService(indexSettings, null, Collections.emptyMap());
|
||||||
|
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetFilterCache.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onCache(ShardId shardId, Accountable accountable) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoval(ShardId shardId, Accountable accountable) {}
|
||||||
|
});
|
||||||
return new MapperService(
|
return new MapperService(
|
||||||
() -> TransportVersion.current(),
|
() -> TransportVersion.current(),
|
||||||
indexSettings,
|
indexSettings,
|
||||||
|
@ -68,6 +78,7 @@ public class MapperTestUtils {
|
||||||
() -> null,
|
() -> null,
|
||||||
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
|
bitsetFilterCache::getBitSetProducer,
|
||||||
MapperMetrics.NOOP
|
MapperMetrics.NOOP
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,9 @@ public class TranslogHandler implements Engine.TranslogRecoveryRunner {
|
||||||
() -> null,
|
() -> null,
|
||||||
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
null,
|
null,
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException("The bitset filter cache is not available in translog operations");
|
||||||
|
},
|
||||||
MapperMetrics.NOOP
|
MapperMetrics.NOOP
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,6 +254,14 @@ public abstract class MapperServiceTestCase extends FieldTypeTestCase {
|
||||||
getPlugins().stream().filter(p -> p instanceof MapperPlugin).map(p -> (MapperPlugin) p).collect(toList())
|
getPlugins().stream().filter(p -> p instanceof MapperPlugin).map(p -> (MapperPlugin) p).collect(toList())
|
||||||
).getMapperRegistry();
|
).getMapperRegistry();
|
||||||
|
|
||||||
|
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetFilterCache.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onCache(ShardId shardId, Accountable accountable) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoval(ShardId shardId, Accountable accountable) {}
|
||||||
|
});
|
||||||
|
|
||||||
return new MapperService(
|
return new MapperService(
|
||||||
() -> TransportVersion.current(),
|
() -> TransportVersion.current(),
|
||||||
indexSettings,
|
indexSettings,
|
||||||
|
@ -266,6 +274,7 @@ public abstract class MapperServiceTestCase extends FieldTypeTestCase {
|
||||||
},
|
},
|
||||||
indexSettings.getMode().buildIdFieldMapper(idFieldDataEnabled),
|
indexSettings.getMode().buildIdFieldMapper(idFieldDataEnabled),
|
||||||
scriptCompiler,
|
scriptCompiler,
|
||||||
|
bitsetFilterCache::getBitSetProducer,
|
||||||
mapperMetrics
|
mapperMetrics
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,10 @@ public class TestDocumentParserContext extends DocumentParserContext {
|
||||||
null,
|
null,
|
||||||
(type, name) -> Lucene.STANDARD_ANALYZER,
|
(type, name) -> Lucene.STANDARD_ANALYZER,
|
||||||
MapperTestCase.createIndexSettings(IndexVersion.current(), settings),
|
MapperTestCase.createIndexSettings(IndexVersion.current(), settings),
|
||||||
null
|
null,
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
),
|
),
|
||||||
source,
|
source,
|
||||||
mappingLookup.getMapping().getRoot(),
|
mappingLookup.getMapping().getRoot(),
|
||||||
|
|
|
@ -1284,7 +1284,10 @@ public abstract class AggregatorTestCase extends ESTestCase {
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
null,
|
null,
|
||||||
indexSettings,
|
indexSettings,
|
||||||
null
|
null,
|
||||||
|
query -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -467,6 +467,13 @@ public abstract class AbstractBuilderTestCase extends ESTestCase {
|
||||||
IndexAnalyzers indexAnalyzers = analysisModule.getAnalysisRegistry().build(IndexCreationContext.CREATE_INDEX, idxSettings);
|
IndexAnalyzers indexAnalyzers = analysisModule.getAnalysisRegistry().build(IndexCreationContext.CREATE_INDEX, idxSettings);
|
||||||
scriptService = new MockScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts);
|
scriptService = new MockScriptService(Settings.EMPTY, scriptModule.engines, scriptModule.contexts);
|
||||||
similarityService = new SimilarityService(idxSettings, null, Collections.emptyMap());
|
similarityService = new SimilarityService(idxSettings, null, Collections.emptyMap());
|
||||||
|
this.bitsetFilterCache = new BitsetFilterCache(idxSettings, new BitsetFilterCache.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onCache(ShardId shardId, Accountable accountable) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoval(ShardId shardId, Accountable accountable) {}
|
||||||
|
});
|
||||||
MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
|
MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
|
||||||
mapperService = new MapperService(
|
mapperService = new MapperService(
|
||||||
clusterService,
|
clusterService,
|
||||||
|
@ -478,23 +485,12 @@ public abstract class AbstractBuilderTestCase extends ESTestCase {
|
||||||
() -> createShardContext(null),
|
() -> createShardContext(null),
|
||||||
idxSettings.getMode().idFieldMapperWithoutFieldData(),
|
idxSettings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
ScriptCompiler.NONE,
|
ScriptCompiler.NONE,
|
||||||
|
bitsetFilterCache::getBitSetProducer,
|
||||||
MapperMetrics.NOOP
|
MapperMetrics.NOOP
|
||||||
);
|
);
|
||||||
IndicesFieldDataCache indicesFieldDataCache = new IndicesFieldDataCache(nodeSettings, new IndexFieldDataCache.Listener() {
|
IndicesFieldDataCache indicesFieldDataCache = new IndicesFieldDataCache(nodeSettings, new IndexFieldDataCache.Listener() {
|
||||||
});
|
});
|
||||||
indexFieldDataService = new IndexFieldDataService(idxSettings, indicesFieldDataCache, new NoneCircuitBreakerService());
|
indexFieldDataService = new IndexFieldDataService(idxSettings, indicesFieldDataCache, new NoneCircuitBreakerService());
|
||||||
bitsetFilterCache = new BitsetFilterCache(idxSettings, new BitsetFilterCache.Listener() {
|
|
||||||
@Override
|
|
||||||
public void onCache(ShardId shardId, Accountable accountable) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRemoval(ShardId shardId, Accountable accountable) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (registerType) {
|
if (registerType) {
|
||||||
mapperService.merge(
|
mapperService.merge(
|
||||||
"_doc",
|
"_doc",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue