public final class IndexModule
extends java.lang.Object
SimilarityProvider
- New SimilarityProvider
implementations can be registered through
addSimilarity(String, TriFunction)
while existing Providers can be referenced through Settings under the
SIMILARITY_SETTINGS_PREFIX
prefix along with the "type" value. For example, to reference the
BM25SimilarityProvider
, the configuration "index.similarity.my_similarity.type : "BM25" can be used.IndexStore
- Custom IndexStore
instances can be registered via addIndexStore(String, Function)
IndexEventListener
- Custom IndexEventListener
instances can be registered via
addIndexEventListener(IndexEventListener)
addSettingsUpdateConsumer(Setting, Consumer)
Modifier and Type | Class and Description |
---|---|
static interface |
IndexModule.IndexSearcherWrapperFactory
Factory for creating new
IndexSearcherWrapper instances |
static class |
IndexModule.Type |
Modifier and Type | Field and Description |
---|---|
static Setting<java.lang.Boolean> |
INDEX_QUERY_CACHE_ENABLED_SETTING |
static Setting<java.lang.Boolean> |
INDEX_QUERY_CACHE_EVERYTHING_SETTING |
static Setting<java.lang.Boolean> |
INDEX_QUERY_CACHE_TERM_QUERIES_SETTING |
static Setting<java.util.List<java.lang.String>> |
INDEX_STORE_PRE_LOAD_SETTING
On which extensions to load data into the file-system cache upon opening of files.
|
static Setting<java.lang.String> |
INDEX_STORE_TYPE_SETTING |
static java.lang.String |
SIMILARITY_SETTINGS_PREFIX |
Constructor and Description |
---|
IndexModule(IndexSettings indexSettings,
AnalysisRegistry analysisRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
addIndexEventListener(IndexEventListener listener)
Adds an
IndexEventListener for this index. |
void |
addIndexOperationListener(IndexingOperationListener listener)
Adds an
IndexingOperationListener for this index. |
void |
addIndexStore(java.lang.String type,
java.util.function.Function<IndexSettings,IndexStore> provider)
Adds an
IndexStore type to this index module. |
void |
addSearchOperationListener(SearchOperationListener listener)
Adds an
SearchOperationListener for this index. |
<T> void |
addSettingsUpdateConsumer(Setting<T> setting,
java.util.function.Consumer<T> consumer)
Adds a Setting and it's consumer for this index.
|
<T> void |
addSettingsUpdateConsumer(Setting<T> setting,
java.util.function.Consumer<T> consumer,
java.util.function.Consumer<T> validator)
Adds a Setting, it's consumer and validator for this index.
|
void |
addSimilarity(java.lang.String name,
TriFunction<java.lang.String,Settings,Settings,SimilarityProvider> similarity)
Registers the given
SimilarityProvider with the given name |
void |
forceQueryCacheProvider(java.util.function.BiFunction<IndexSettings,IndicesQueryCache,QueryCache> queryCacheProvider)
Forces a certain query cache to use instead of the default one.
|
Index |
getIndex()
Returns the index this module is associated with
|
Settings |
getSettings()
Returns the index
Settings for this index |
MapperService |
newIndexMapperService(NamedXContentRegistry xContentRegistry,
MapperRegistry mapperRegistry)
creates a new mapper service to do administrative work like mapping updates.
|
IndexService |
newIndexService(NodeEnvironment environment,
NamedXContentRegistry xContentRegistry,
IndexService.ShardStoreDeleter shardStoreDeleter,
CircuitBreakerService circuitBreakerService,
BigArrays bigArrays,
ThreadPool threadPool,
ScriptService scriptService,
Client client,
IndicesQueryCache indicesQueryCache,
MapperRegistry mapperRegistry,
IndicesFieldDataCache indicesFieldDataCache) |
void |
setSearcherWrapper(IndexModule.IndexSearcherWrapperFactory indexSearcherWrapperFactory)
Sets a
IndexModule.IndexSearcherWrapperFactory that is called once the IndexService
is fully constructed. |
public static final Setting<java.lang.String> INDEX_STORE_TYPE_SETTING
public static final Setting<java.util.List<java.lang.String>> INDEX_STORE_PRE_LOAD_SETTING
public static final java.lang.String SIMILARITY_SETTINGS_PREFIX
public static final Setting<java.lang.Boolean> INDEX_QUERY_CACHE_ENABLED_SETTING
public static final Setting<java.lang.Boolean> INDEX_QUERY_CACHE_EVERYTHING_SETTING
public static final Setting<java.lang.Boolean> INDEX_QUERY_CACHE_TERM_QUERIES_SETTING
public IndexModule(IndexSettings indexSettings, AnalysisRegistry analysisRegistry)
public <T> void addSettingsUpdateConsumer(Setting<T> setting, java.util.function.Consumer<T> consumer)
public <T> void addSettingsUpdateConsumer(Setting<T> setting, java.util.function.Consumer<T> consumer, java.util.function.Consumer<T> validator)
public Index getIndex()
public void addIndexEventListener(IndexEventListener listener)
IndexEventListener
for 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.
public void addSearchOperationListener(SearchOperationListener listener)
SearchOperationListener
for 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.
public void addIndexOperationListener(IndexingOperationListener listener)
IndexingOperationListener
for 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.
public void addIndexStore(java.lang.String type, java.util.function.Function<IndexSettings,IndexStore> provider)
IndexStore
type to this index module. Typically stores are registered with a reference to
it's constructor:
indexModule.addIndexStore("my_store_type", MyStore::new);
type
- the type to registerprovider
- the instance provider / factory methodpublic void addSimilarity(java.lang.String name, TriFunction<java.lang.String,Settings,Settings,SimilarityProvider> similarity)
SimilarityProvider
with the given namename
- Name of the SimilarityProvidersimilarity
- SimilarityProvider to registerpublic void setSearcherWrapper(IndexModule.IndexSearcherWrapperFactory indexSearcherWrapperFactory)
IndexModule.IndexSearcherWrapperFactory
that is called once the IndexService
is fully constructed.
Note: this method can only be called once per index. Multiple wrappers are not supported.public IndexService newIndexService(NodeEnvironment environment, NamedXContentRegistry xContentRegistry, IndexService.ShardStoreDeleter shardStoreDeleter, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ScriptService scriptService, Client client, IndicesQueryCache indicesQueryCache, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache) throws java.io.IOException
java.io.IOException
public MapperService newIndexMapperService(NamedXContentRegistry xContentRegistry, MapperRegistry mapperRegistry) throws java.io.IOException
java.io.IOException
public void forceQueryCacheProvider(java.util.function.BiFunction<IndexSettings,IndicesQueryCache,QueryCache> queryCacheProvider)
index.queries.cache.enabled
, then
the given provider will be used.
NOTE: this can only be set onceINDEX_QUERY_CACHE_ENABLED_SETTING