/** * Forces a certain query cache to use instead of the default one. If this is set * and query caching is not disabled with {@code index.queries.cache.enabled}, then * the given provider will be used. * NOTE: this can only be set once * * @see #INDEX_QUERY_CACHE_ENABLED_SETTING */ public void forceQueryCacheProvider(BiFunction<IndexSettings, IndicesQueryCache, QueryCache> queryCacheProvider) { ensureNotFrozen(); this.forceQueryCacheProvider.set(queryCacheProvider); }
/** * Sets a {@link org.elasticsearch.index.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 void setSearcherWrapper(IndexSearcherWrapperFactory indexSearcherWrapperFactory) { ensureNotFrozen(); this.indexSearcherWrapper.set(indexSearcherWrapperFactory); }
/** * Registers the given {@link Similarity} with the given name. * The function takes as parameters:<ul> * <li>settings for this similarity * <li>version of Elasticsearch when the index was created * <li>ScriptService, for script-based similarities * </ul> * * @param name Name of the SimilarityProvider * @param similarity SimilarityProvider to register */ public void addSimilarity(String name, TriFunction<Settings, Version, ScriptService, Similarity> similarity) { ensureNotFrozen(); if (similarities.containsKey(name) || SimilarityService.BUILT_IN.containsKey(name)) { throw new IllegalArgumentException("similarity for name: [" + name + " is already registered"); } similarities.put(name, similarity); }
/** * Adds an {@link 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. * <p> * 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. * </p> */ public void addIndexEventListener(IndexEventListener listener) { ensureNotFrozen(); if (listener == null) { throw new IllegalArgumentException("listener must not be null"); } if (indexEventListeners.contains(listener)) { throw new IllegalArgumentException("listener already added"); } this.indexEventListeners.add(listener); }
/** * Adds an {@link 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. * <p> * 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. * </p> */ public void addSearchOperationListener(SearchOperationListener listener) { ensureNotFrozen(); if (listener == null) { throw new IllegalArgumentException("listener must not be null"); } if (searchOperationListeners.contains(listener)) { throw new IllegalArgumentException("listener already added"); } this.searchOperationListeners.add(listener); }
/** * Adds an {@link 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. * <p> * 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. * </p> */ public void addIndexOperationListener(IndexingOperationListener listener) { ensureNotFrozen(); if (listener == null) { throw new IllegalArgumentException("listener must not be null"); } if (indexOperationListeners.contains(listener)) { throw new IllegalArgumentException("listener already added"); } this.indexOperationListeners.add(listener); }
/** * Adds a Setting and it's consumer for this index. */ public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer) { ensureNotFrozen(); if (setting == null) { throw new IllegalArgumentException("setting must not be null"); } indexSettings.getScopedSettings().addSettingsUpdateConsumer(setting, consumer); }
/** * Adds a Setting, it's consumer and validator for this index. */ public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer, Consumer<T> validator) { ensureNotFrozen(); if (setting == null) { throw new IllegalArgumentException("setting must not be null"); } indexSettings.getScopedSettings().addSettingsUpdateConsumer(setting, consumer, validator); }
/** * Registers the given {@link SimilarityProvider} with the given name * * @param name Name of the SimilarityProvider * @param similarity SimilarityProvider to register */ public void addSimilarity(String name, BiFunction<String, Settings, SimilarityProvider> similarity) { ensureNotFrozen(); if (similarities.containsKey(name) || SimilarityService.BUILT_IN.containsKey(name)) { throw new IllegalArgumentException("similarity for name: [" + name + " is already registered"); } similarities.put(name, similarity); }
/** * Adds an {@link IndexStore} type to this index module. Typically stores are registered with a reference to * it's constructor: * <pre> * indexModule.addIndexStore("my_store_type", MyStore::new); * </pre> * * @param type the type to register * @param provider the instance provider / factory method */ public void addIndexStore(String type, BiFunction<IndexSettings, IndexStoreConfig, IndexStore> provider) { ensureNotFrozen(); if (storeTypes.containsKey(type)) { throw new IllegalArgumentException("key [" + type +"] already registered"); } storeTypes.put(type, provider); }
/** * Registers the given {@link Similarity} with the given name. * The function takes as parameters:<ul> * <li>settings for this similarity * <li>version of Elasticsearch when the index was created * <li>ScriptService, for script-based similarities * </ul> * * @param name Name of the SimilarityProvider * @param similarity SimilarityProvider to register */ public void addSimilarity(String name, TriFunction<Settings, Version, ScriptService, Similarity> similarity) { ensureNotFrozen(); if (similarities.containsKey(name) || SimilarityService.BUILT_IN.containsKey(name)) { throw new IllegalArgumentException("similarity for name: [" + name + " is already registered"); } similarities.put(name, similarity); }
/** * Forces a certain query cache to use instead of the default one. If this is set * and query caching is not disabled with {@code index.queries.cache.enabled}, then * the given provider will be used. * NOTE: this can only be set once * * @see #INDEX_QUERY_CACHE_ENABLED_SETTING */ public void forceQueryCacheProvider(BiFunction<IndexSettings, IndicesQueryCache, QueryCache> queryCacheProvider) { ensureNotFrozen(); this.forceQueryCacheProvider.set(queryCacheProvider); }
/** * Sets a {@link org.elasticsearch.index.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 void setSearcherWrapper(IndexSearcherWrapperFactory indexSearcherWrapperFactory) { ensureNotFrozen(); this.indexSearcherWrapper.set(indexSearcherWrapperFactory); }
/** * Forces a certain query cache to use instead of the default one. If this is set * and query caching is not disabled with {@code index.queries.cache.enabled}, then * the given provider will be used. * NOTE: this can only be set once * * @see #INDEX_QUERY_CACHE_ENABLED_SETTING */ public void forceQueryCacheProvider(BiFunction<IndexSettings, IndicesQueryCache, QueryCache> queryCacheProvider) { ensureNotFrozen(); this.forceQueryCacheProvider.set(queryCacheProvider); }
/** * Sets a {@link org.elasticsearch.index.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 void setSearcherWrapper(IndexSearcherWrapperFactory indexSearcherWrapperFactory) { ensureNotFrozen(); this.indexSearcherWrapper.set(indexSearcherWrapperFactory); }
/** * Adds a Setting, it's consumer and validator for this index. */ public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer, Consumer<T> validator) { ensureNotFrozen(); if (setting == null) { throw new IllegalArgumentException("setting must not be null"); } indexSettings.getScopedSettings().addSettingsUpdateConsumer(setting, consumer, validator); }
/** * Adds a Setting and it's consumer for this index. */ public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer) { ensureNotFrozen(); if (setting == null) { throw new IllegalArgumentException("setting must not be null"); } indexSettings.getScopedSettings().addSettingsUpdateConsumer(setting, consumer); }
/** * Adds a Setting, it's consumer and validator for this index. */ public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer, Consumer<T> validator) { ensureNotFrozen(); if (setting == null) { throw new IllegalArgumentException("setting must not be null"); } indexSettings.getScopedSettings().addSettingsUpdateConsumer(setting, consumer, validator); }
/** * Adds a Setting and it's consumer for this index. */ public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer) { ensureNotFrozen(); if (setting == null) { throw new IllegalArgumentException("setting must not be null"); } indexSettings.getScopedSettings().addSettingsUpdateConsumer(setting, consumer); }
/** * Adds a Setting, it's consumer and validator for this index. */ public <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer, Consumer<T> validator) { ensureNotFrozen(); if (setting == null) { throw new IllegalArgumentException("setting must not be null"); } indexSettings.getScopedSettings().addSettingsUpdateConsumer(setting, consumer, validator); }