org.hibernate.search.elasticsearch.impl

## Class ElasticsearchIndexManager

- java.lang.Object
- - org.hibernate.search.elasticsearch.impl.ElasticsearchIndexManager

- All Implemented Interfaces:
    IndexManager, IndexNameNormalizer

      public class ElasticsearchIndexManager
      extends Object
      implements IndexManager, IndexNameNormalizer

  An `IndexManager` applying indexing work to an Elasticsearch server.
  Author:
    Gunnar Morling

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ElasticsearchIndexManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addContainedEntity(IndexedTypeIdentifier entity)`
    `void` | `awaitAsyncProcessingCompletion()` Blocks until all the previously submitted work via `IndexManager.performStreamOperation(LuceneWork, IndexingMonitor, boolean)` are applied to the index.
    `void` | `destroy()` Called when a `SearchFactory` is stopped.
    `void` | `flushAndReleaseResources()` Flushes any pending write operations and closes underlying resources, for example release the index locks if this implementation uses a Lucene IndexWriter.
    `String` | `getActualIndexName()` Some index managers need to normalize the name of the index before using it with the backend, this method will return the actual name used by the index manager.
    `Analyzer` | `getAnalyzer(String name)`
    `IndexedTypeSet` | `getContainedTypes()`
    `ElasticsearchService` | `getElasticsearchService()`
    `IndexManagerType` | `getIndexManagerType()`
    `String` | `getIndexName()` Useful for labeling and logging resources from this instance.
    `ReaderProvider` | `getReaderProvider()` Provide access to `IndexReader`s.
    `LuceneWorkSerializer` | `getSerializer()`
    `Similarity` | `getSimilarity()`
    `void` | `initialize(String indexName, Properties properties, Similarity similarity, WorkerBuildContext context)` Initialize this `IndexManager` before its use.
    `void` | `optimize()` To optimize the underlying index.
    `void` | `performOperations(List<LuceneWork> workList, IndexingMonitor monitor)` Used to apply update operations to the index.
    `void` | `performStreamOperation(LuceneWork singleOperation, IndexingMonitor monitor, boolean forceAsync)` Perform a single non-transactional operation, best to stream large amounts of operations.
    `void` | `setSearchFactory(ExtendedSearchIntegrator boundSearchIntegrator)` Connects this `IndexManager` to a new `ExtendedSearchIntegrator`.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ElasticsearchIndexManager

          public ElasticsearchIndexManager()

  - ### Method Detail

    - #### initialize

          public void initialize(String indexName,
                                 Properties properties,
                                 Similarity similarity,
                                 WorkerBuildContext context)

      Description copied from interface: `IndexManager`
      Initialize this `IndexManager` before its use.
      Specified by:
        `initialize` in interface `IndexManager`
      Parameters:
        `indexName` - the unique name of the index (manager). Can be used to retrieve a `IndexManager` instance via the search factory and `IndexManagerHolder`.
        `properties` - the configuration properties
        `similarity` - defines the component of Lucene scoring
        `context` - context information needed to initialize this index manager

    - #### getElasticsearchService

          public ElasticsearchService getElasticsearchService()

      Returns:
        the ElasticsearchService used by this index manager.

    - #### destroy

          public void destroy()

      Description copied from interface: `IndexManager`
      Called when a `SearchFactory` is stopped. This method typically releases resources.
      Specified by:
        `destroy` in interface `IndexManager`

    - #### setSearchFactory

          public void setSearchFactory(ExtendedSearchIntegrator boundSearchIntegrator)

      Description copied from interface: `IndexManager`
      Connects this `IndexManager` to a new `ExtendedSearchIntegrator`.
      Specified by:
        `setSearchFactory` in interface `IndexManager`
      Parameters:
        `boundSearchIntegrator` - the existing search factory to which to associate this index manager with

    - #### addContainedEntity

          public void addContainedEntity(IndexedTypeIdentifier entity)

      Specified by:
        `addContainedEntity` in interface `IndexManager`
      Parameters:
        `entity` - Adds the specified entity type to this index manager, making it responsible for manging this type.

    - #### getIndexName

          public String getIndexName()

      Description copied from interface: `IndexManager`
      Useful for labeling and logging resources from this instance.
      Specified by:
        `getIndexName` in interface `IndexManager`
      Returns:
        the name of the index maintained by this manager.

    - #### getReaderProvider

          public ReaderProvider getReaderProvider()

      Description copied from interface: `IndexManager`
      Provide access to `IndexReader`s.
      Specified by:
        `getReaderProvider` in interface `IndexManager`
      Returns:
        a `ReaderProvider` instance for the index managed by this instance

    - #### getContainedTypes

          public IndexedTypeSet getContainedTypes()

      Specified by:
        `getContainedTypes` in interface `IndexManager`
      Returns:
        the set of classes being indexed in this manager

    - #### getSimilarity

          public Similarity getSimilarity()

      Specified by:
        `getSimilarity` in interface `IndexManager`
      Returns:
        the `Similarity` applied to this index. Note, only a single `Similarity` can be applied to a given index.

    - #### getAnalyzer

          public Analyzer getAnalyzer(String name)

      Specified by:
        `getAnalyzer` in interface `IndexManager`
      Parameters:
        `name` - the name of the analyzer to retrieve.
      Returns:
        Returns the `Analyzer` with the given name (see also `AnalyzerDef`)

    - #### getSerializer

          public LuceneWorkSerializer getSerializer()

      Specified by:
        `getSerializer` in interface `IndexManager`

    - #### flushAndReleaseResources

          public void flushAndReleaseResources()

      Description copied from interface: `IndexManager`
      Flushes any pending write operations and closes underlying resources, for example release the index locks if this implementation uses a Lucene IndexWriter.
      Specified by:
        `flushAndReleaseResources` in interface `IndexManager`

    - #### getActualIndexName

          public String getActualIndexName()

      Description copied from interface: `IndexNameNormalizer`
      Some index managers need to normalize the name of the index before using it with the backend, this method will return the actual name used by the index manager.

      Elasticsearch, for example, will lowercase the name giving space to possible conflicts.

      Specified by:
        `getActualIndexName` in interface `IndexNameNormalizer`
      Returns:
        the actual index name used by the index manager

    - #### performOperations

          public void performOperations(List<LuceneWork> workList,
                                        IndexingMonitor monitor)

      Description copied from interface: `IndexManager`
      Used to apply update operations to the index. Operations can be applied in sync or async, depending on the IndexManager implementation and configuration.
      Specified by:
        `performOperations` in interface `IndexManager`
      Parameters:
        `workList` - the list of write operations to apply.
        `monitor` - no be notified of indexing events

    - #### performStreamOperation

          public void performStreamOperation(LuceneWork singleOperation,
                                             IndexingMonitor monitor,
                                             boolean forceAsync)

      Description copied from interface: `IndexManager`
      Perform a single non-transactional operation, best to stream large amounts of operations. Operations might be applied out-of-order! To mark two series of operations which need to be applied in order, use a transactional operation between them: a transactional operation will always flush all streaming operations first, and be applied before subsequent streaming operations.
      Specified by:
        `performStreamOperation` in interface `IndexManager`
      Parameters:
        `singleOperation` - the operation to perform
        `monitor` - no be notified of indexing events
        `forceAsync` - if true, the invocation will not block to wait for it being applied. When false this will depend on the backend configuration.

    - #### awaitAsyncProcessingCompletion

          public void awaitAsyncProcessingCompletion()

      Description copied from interface: `IndexManager`
      Blocks until all the previously submitted work via `IndexManager.performStreamOperation(LuceneWork, IndexingMonitor, boolean)` are applied to the index.
      Specified by:
        `awaitAsyncProcessingCompletion` in interface `IndexManager`

    - #### optimize

          public void optimize()

      Description copied from interface: `IndexManager`
      To optimize the underlying index. Some implementations might ignore the request, if it doesn't apply to them.
      Specified by:
        `optimize` in interface `IndexManager`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getIndexManagerType

          public IndexManagerType getIndexManagerType()

      Specified by:
        `getIndexManagerType` in interface `IndexManager`
      Returns:
        the `IndexManagerType` of this implementation.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved