public class ElasticsearchIndexManager extends Object implements IndexManager, IndexNameNormalizer
IndexManager
applying indexing work to an Elasticsearch server.Constructor and Description |
---|
ElasticsearchIndexManager() |
Modifier and Type | Method and Description |
---|---|
void |
addContainedEntity(Class<?> 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) |
Set<Class<?>> |
getContainedTypes() |
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. |
boolean |
needsRefreshAfterWrite() |
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() |
public void initialize(String indexName, Properties properties, Similarity similarity, WorkerBuildContext context)
IndexManager
IndexManager
before its use.initialize
in interface IndexManager
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 propertiessimilarity
- defines the component of Lucene scoringcontext
- context information needed to initialize this index managerpublic void destroy()
IndexManager
SearchFactory
is stopped. This method typically releases resources.destroy
in interface IndexManager
public void setSearchFactory(ExtendedSearchIntegrator boundSearchIntegrator)
IndexManager
IndexManager
to a new ExtendedSearchIntegrator
.setSearchFactory
in interface IndexManager
boundSearchIntegrator
- the existing search factory to which to associate this index manager withpublic void addContainedEntity(Class<?> entity)
addContainedEntity
in interface IndexManager
entity
- Adds the specified entity type to this index manager, making it responsible for manging this type.public String getIndexName()
IndexManager
getIndexName
in interface IndexManager
public ReaderProvider getReaderProvider()
IndexManager
IndexReader
s.getReaderProvider
in interface IndexManager
ReaderProvider
instance for the index managed by this instancepublic Set<Class<?>> getContainedTypes()
getContainedTypes
in interface IndexManager
public Similarity getSimilarity()
getSimilarity
in interface IndexManager
Similarity
applied to this index. Note, only a single Similarity
can be applied to
a given index.public Analyzer getAnalyzer(String name)
getAnalyzer
in interface IndexManager
name
- the name of the analyzer to retrieve.Analyzer
with the given name (see also AnalyzerDef
)public LuceneWorkSerializer getSerializer()
getSerializer
in interface IndexManager
public void flushAndReleaseResources()
IndexManager
flushAndReleaseResources
in interface IndexManager
public String getActualIndexName()
IndexNameNormalizer
Elasticsearch, for example, will lowercase the name giving space to possible conflicts.
getActualIndexName
in interface IndexNameNormalizer
public boolean needsRefreshAfterWrite()
public void performOperations(List<LuceneWork> workList, IndexingMonitor monitor)
IndexManager
performOperations
in interface IndexManager
workList
- the list of write operations to apply.monitor
- no be notified of indexing eventspublic void performStreamOperation(LuceneWork singleOperation, IndexingMonitor monitor, boolean forceAsync)
IndexManager
performStreamOperation
in interface IndexManager
singleOperation
- the operation to performmonitor
- no be notified of indexing eventsforceAsync
- if true, the invocation will not block to wait for it being applied.
When false this will depend on the backend configuration.public void awaitAsyncProcessingCompletion()
IndexManager
IndexManager.performStreamOperation(LuceneWork, IndexingMonitor, boolean)
are applied to the index.awaitAsyncProcessingCompletion
in interface IndexManager
public void optimize()
IndexManager
optimize
in interface IndexManager
public IndexManagerType getIndexManagerType()
getIndexManagerType
in interface IndexManager
IndexManagerType
of this implementation.Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved