Class IndexModule

    • Field Detail

      • NODE_STORE_ALLOW_MMAP

        public static final Setting<java.lang.Boolean> NODE_STORE_ALLOW_MMAP
      • INDEX_STORE_TYPE_SETTING

        public static final Setting<java.lang.String> INDEX_STORE_TYPE_SETTING
      • INDEX_STORE_PRE_LOAD_SETTING

        public static final 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. This only works with the mmap directory, and even in that case is still best-effort only.
      • SIMILARITY_SETTINGS_PREFIX

        public static final java.lang.String SIMILARITY_SETTINGS_PREFIX
        See Also:
        Constant Field Values
      • INDEX_QUERY_CACHE_ENABLED_SETTING

        public static final Setting<java.lang.Boolean> INDEX_QUERY_CACHE_ENABLED_SETTING
      • INDEX_QUERY_CACHE_EVERYTHING_SETTING

        public static final Setting<java.lang.Boolean> INDEX_QUERY_CACHE_EVERYTHING_SETTING
    • Method Detail

      • addSettingsUpdateConsumer

        public <T> void addSettingsUpdateConsumer​(Setting<T> setting,
                                                  java.util.function.Consumer<T> consumer)
        Adds a Setting and it's consumer for this index.
      • addSettingsUpdateConsumer

        public <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.
      • getSettings

        public Settings getSettings()
        Returns the index Settings for this index
      • getIndex

        public Index getIndex()
        Returns the index this module is associated with
      • addIndexEventListener

        public void addIndexEventListener​(IndexEventListener listener)
        Adds an 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.

      • addSearchOperationListener

        public void addSearchOperationListener​(SearchOperationListener listener)
        Adds an 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.

      • addIndexOperationListener

        public void addIndexOperationListener​(IndexingOperationListener listener)
        Adds an 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.

      • addSimilarity

        public void addSimilarity​(java.lang.String name,
                                  TriFunction<Settings,​Version,​ScriptService,​org.apache.lucene.search.similarities.Similarity> similarity)
        Registers the given Similarity with 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 SimilarityProvider
        similarity - SimilarityProvider to register
      • setReaderWrapper

        public void setReaderWrapper​(java.util.function.Function<IndexService,​CheckedFunction<org.apache.lucene.index.DirectoryReader,​org.apache.lucene.index.DirectoryReader,​java.io.IOException>> indexReaderWrapperFactory)
        Sets the factory for creating new DirectoryReader wrapper 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 CheckedFunction is invoked each time a Engine.Searcher is 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 delegate IndexReader.getReaderCacheHelper(), LeafReader.getCoreCacheHelper() and must be an instance of FilterDirectoryReader that eventually exposes the original reader via FilterDirectoryReader.getDelegate(). The returned reader is closed once it goes out of scope.

      • isBuiltinType

        public static boolean isBuiltinType​(java.lang.String storeType)
      • defaultStoreType

        public static IndexModule.Type defaultStoreType​(boolean allowMmap)
      • newIndexMapperService

        public MapperService newIndexMapperService​(NamedXContentRegistry xContentRegistry,
                                                   MapperRegistry mapperRegistry,
                                                   ScriptService scriptService)
                                            throws java.io.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:
        java.io.IOException
      • forceQueryCacheProvider

        public void forceQueryCacheProvider​(java.util.function.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 with index.queries.cache.enabled, then the given provider will be used. NOTE: this can only be set once
        See Also:
        INDEX_QUERY_CACHE_ENABLED_SETTING