Similarity- NewSimilarityimplementations can be registered throughaddSimilarity(String, TriFunction)while existing Providers can be referenced through Settings under theSIMILARITY_SETTINGS_PREFIXprefix along with the "type" value. For example, to reference theBM25Similarity, the configuration"index.similarity.my_similarity.type : "BM25"can be used.IndexStorePlugin.DirectoryFactory- CustomIndexStorePlugin.DirectoryFactoryinstances can be registered viaIndexStorePluginIndexEventListener- CustomIndexEventListenerinstances can be registered viaaddIndexEventListener(IndexEventListener)- Settings update listener - Custom settings update listener can be registered via
addSettingsUpdateConsumer(Setting, Consumer)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDirectorywrappers allow to apply a function to the Lucene directory instances created byIndexStorePlugin.DirectoryFactory.static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IndexStorePlugin.SnapshotCommitSupplierOn which extensions to load data into the file-system cache upon opening of files.static final String -
Constructor Summary
ConstructorsConstructorDescriptionIndexModule(IndexSettings indexSettings, AnalysisRegistry analysisRegistry, EngineFactory engineFactory, Map<String, IndexStorePlugin.DirectoryFactory> directoryFactories, BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, Map<String, IndexStorePlugin.RecoveryStateFactory> recoveryStateFactories, SlowLogFieldProvider slowLogFieldProvider, MapperMetrics mapperMetrics, List<SearchOperationListener> searchOperationListeners) Construct the index module for the index with the specified index settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIndexEventListener(IndexEventListener listener) Adds anIndexEventListenerfor this index.voidAdds anIndexingOperationListenerfor this index.voidAdds anSearchOperationListenerfor this index.<T> voidaddSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer) Adds a Setting and it's consumer for this index.<T> voidaddSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer, Consumer<T> validator) Adds a Setting, it's consumer and validator for this index.voidaddSimilarity(String name, TriFunction<Settings, IndexVersion, ScriptService, org.apache.lucene.search.similarities.Similarity> similarity) Registers the givenSimilaritywith the given name.static IndexModule.TypedefaultStoreType(boolean allowMmap) voidforceQueryCacheProvider(BiFunction<IndexSettings, IndicesQueryCache, QueryCache> queryCacheProvider) Forces a certain query cache to use instead of the default one.getIndex()Returns the index this module is associated withReturns the indexSettingsfor this indexReturns theIndexSettingsfor this indexstatic booleanisBuiltinType(String storeType) newIndexMapperService(ClusterService clusterService, XContentParserConfiguration parserConfiguration, MapperRegistry mapperRegistry, ScriptService scriptService) creates a new mapper service to do administrative work like mapping updates.newIndexService(IndexService.IndexCreationContext indexCreationContext, NodeEnvironment environment, XContentParserConfiguration parserConfiguration, IndexService.ShardStoreDeleter shardStoreDeleter, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ThreadPoolMergeExecutorService threadPoolMergeExecutorService, ScriptService scriptService, ClusterService clusterService, Client client, IndicesQueryCache indicesQueryCache, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, NamedWriteableRegistry namedWriteableRegistry, IdFieldMapper idFieldMapper, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.IndexFoldersDeletionListener indexFoldersDeletionListener, Map<String, IndexStorePlugin.SnapshotCommitSupplier> snapshotCommitSuppliers, QueryRewriteInterceptor queryRewriteInterceptor) voidSets aDirectorywrapping method that allows to apply a function to the Lucene directory instance created byIndexStorePlugin.DirectoryFactory.voidvoidsetReaderWrapper(Function<IndexService, CheckedFunction<org.apache.lucene.index.DirectoryReader, org.apache.lucene.index.DirectoryReader, IOException>> indexReaderWrapperFactory) Sets the factory for creating newDirectoryReaderwrapper instances.
-
Field Details
-
NODE_STORE_ALLOW_MMAP
-
INDEX_STORE_TYPE_SETTING
-
INDEX_RECOVERY_TYPE_SETTING
-
INDEX_STORE_PRE_LOAD_SETTING
On which extensions to load data into the file-system cache upon opening of files. This only works with the mmap directory, and even in that case is still best-effort only. -
SIMILARITY_SETTINGS_PREFIX
- See Also:
-
INDEX_QUERY_CACHE_ENABLED_SETTING
-
INDEX_QUERY_CACHE_EVERYTHING_SETTING
-
DEFAULT_SNAPSHOT_COMMIT_SUPPLIER
-
-
Constructor Details
-
IndexModule
public IndexModule(IndexSettings indexSettings, AnalysisRegistry analysisRegistry, EngineFactory engineFactory, Map<String, IndexStorePlugin.DirectoryFactory> directoryFactories, BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, Map<String, IndexStorePlugin.RecoveryStateFactory> recoveryStateFactories, SlowLogFieldProvider slowLogFieldProvider, MapperMetrics mapperMetrics, List<SearchOperationListener> searchOperationListeners) Construct the index module for the index with the specified index settings. The index module contains extension points for plugins viaPlugin.onIndexModule(IndexModule).- Parameters:
indexSettings- the index settingsanalysisRegistry- the analysis registryengineFactory- the engine factorydirectoryFactories- the available store types
-
-
Method Details
-
addSettingsUpdateConsumer
Adds a Setting and it's consumer for this index. -
addSettingsUpdateConsumer
public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer, Consumer<T> validator) Adds a Setting, it's consumer and validator for this index. -
getSettings
Returns the indexSettingsfor this index -
indexSettings
Returns theIndexSettingsfor this index -
getIndex
Returns the index this module is associated with -
addIndexEventListener
Adds anIndexEventListenerfor this index. All listeners added here are maintained for the entire index lifecycle on this node. Once an index is closed or deleted these listeners go out of scope.Note: an index might be created on a node multiple times. For instance if the last shard from an index is relocated to another node the internal representation will be destroyed which includes the registered listeners. Once the node holds at least one shard of an index all modules are reloaded and listeners are registered again. Listeners can't be unregistered they will stay alive for the entire time the index is allocated on a node.
-
addSearchOperationListener
Adds anSearchOperationListenerfor this index. All listeners added here are maintained for the entire index lifecycle on this node. Once an index is closed or deleted these listeners go out of scope.Note: an index might be created on a node multiple times. For instance if the last shard from an index is relocated to another node the internal representation will be destroyed which includes the registered listeners. Once the node holds at least one shard of an index all modules are reloaded and listeners are registered again. Listeners can't be unregistered they will stay alive for the entire time the index is allocated on a node.
-
addIndexOperationListener
Adds anIndexingOperationListenerfor this index. All listeners added here are maintained for the entire index lifecycle on this node. Once an index is closed or deleted these listeners go out of scope.Note: an index might be created on a node multiple times. For instance if the last shard from an index is relocated to another node the internal representation will be destroyed which includes the registered listeners. Once the node holds at least one shard of an index all modules are reloaded and listeners are registered again. Listeners can't be unregistered they will stay alive for the entire time the index is allocated on a node.
-
addSimilarity
public void addSimilarity(String name, TriFunction<Settings, IndexVersion, ScriptService, org.apache.lucene.search.similarities.Similarity> similarity) Registers the givenSimilaritywith the given name. The function takes as parameters:- settings for this similarity
- version of Elasticsearch when the index was created
- ScriptService, for script-based similarities
- Parameters:
name- Name of the SimilarityProvidersimilarity- SimilarityProvider to register
-
setReaderWrapper
public void setReaderWrapper(Function<IndexService, CheckedFunction<org.apache.lucene.index.DirectoryReader, org.apache.lucene.index.DirectoryReader, IOException>> indexReaderWrapperFactory) Sets the factory for creating newDirectoryReaderwrapper instances. The factory (Function) is called once the IndexService is fully constructed. NOTE: this method can only be called once per index. Multiple wrappers are not supported.The
CheckedFunctionis invoked each time aEngine.Searcheris requested to do an operation, for example search, and must return a new directory reader wrapping the provided directory reader or if no wrapping was performed the provided directory reader. The wrapped reader can filter out document just like delete documents etc. but must not change any term or document content. NOTE: The index reader wrapper (CheckedFunction) has a per-request lifecycle, must delegateIndexReader.getReaderCacheHelper(),LeafReader.getCoreCacheHelper()and must be an instance ofFilterDirectoryReaderthat eventually exposes the original reader viaFilterDirectoryReader.getDelegate(). The returned reader is closed once it goes out of scope. -
setDirectoryWrapper
Sets aDirectorywrapping method that allows to apply a function to the Lucene directory instance created byIndexStorePlugin.DirectoryFactory.- Parameters:
wrapper- the wrapping function
-
setIndexCommitListener
-
isBuiltinType
-
defaultStoreType
-
newIndexService
public IndexService newIndexService(IndexService.IndexCreationContext indexCreationContext, NodeEnvironment environment, XContentParserConfiguration parserConfiguration, IndexService.ShardStoreDeleter shardStoreDeleter, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ThreadPoolMergeExecutorService threadPoolMergeExecutorService, ScriptService scriptService, ClusterService clusterService, Client client, IndicesQueryCache indicesQueryCache, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, NamedWriteableRegistry namedWriteableRegistry, IdFieldMapper idFieldMapper, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.IndexFoldersDeletionListener indexFoldersDeletionListener, Map<String, IndexStorePlugin.SnapshotCommitSupplier> snapshotCommitSuppliers, QueryRewriteInterceptor queryRewriteInterceptor) throws IOException- Throws:
IOException
-
newIndexMapperService
public MapperService newIndexMapperService(ClusterService clusterService, XContentParserConfiguration parserConfiguration, MapperRegistry mapperRegistry, ScriptService scriptService) throws IOException creates a new mapper service to do administrative work like mapping updates. This *should not* be used for document parsing. doing so will result in an exception.- Throws:
IOException
-
forceQueryCacheProvider
public void forceQueryCacheProvider(BiFunction<IndexSettings, IndicesQueryCache, QueryCache> queryCacheProvider) Forces a certain query cache to use instead of the default one. If this is set and query caching is not disabled withindex.queries.cache.enabled, then the given provider will be used. NOTE: this can only be set once- See Also:
-