Class ElasticsearchRepository
- java.lang.Object
-
- lumis.portal.bigdata.elasticsearch.ElasticsearchRepository
-
- All Implemented Interfaces:
IBigDataIndexer
,IBigDataRepository
,IBigDataSearcher
,IBigDataRepositorySPI
public class ElasticsearchRepository extends java.lang.Object implements IBigDataRepositorySPI
Big data repository implementation that uses Elasticsearch.- Since:
- 8.1.0
- Version:
- $Revision: 25354 $ $Date: 2022-11-10 12:42:27 -0300 (Thu, 10 Nov 2022) $
-
-
Field Summary
Fields Modifier and Type Field Description protected BulkProcessor
bulkProcessor
TheBulkProcessor
instance shared withIBatchIndexer
generated by this repository.protected org.elasticsearch.client.RestHighLevelClient
client
static java.util.List<java.util.Locale>
NATIVE_TEMPLATES_SYNONYMS_LOCALES
protected ElasticsearchRepository
repository
protected org.elasticsearch.client.RequestOptions
requestOptions
-
Constructor Summary
Constructors Constructor Description ElasticsearchRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addDocument(Document document)
Adds a document to the index.void
addDocumentToIndexQueue(Document document)
Adds a document that may be delayed until it is indexed.void
addIndex(java.util.Locale locale)
Adds the indices relative to the given locale in Elasticsearch.void
addOrUpdateDocument(Document document)
Adds or updates a document on the index.void
addOrUpdateDocumentType(DocumentType documentType)
Deprecated.void
addOrUpdateDocumentType(DocumentType documentType, boolean force)
Adds or updates a document type into managed indices.
If the managed indices couldn't be updated in underlying big data repository:
Ifforce
parameter istrue
, they will be recreated, causing data loss. Else, anIllegalArgumentException
will be raised.void
deleteDocument(DocumentType documentType, java.util.Locale locale, java.lang.String documentId)
Deletes a document from the index with the given specifications.void
deleteDocumentsByFieldValue(java.lang.String fieldId, java.lang.Object... values)
Deletes documents that are matched by one of the given values in the field of given field identifier.void
deleteDocumentsByFieldValue(java.lang.String fieldId, java.util.Collection<?> values)
Deletes documents that are matched by one of the given values in the field of given field identifier.void
deleteDocumentsByQuery(SearchQuery searchQuery)
Deletes documents that are matched by the given search query.
The search query'ssorts
,initial hit
andmaximum hit count
will be ignored.void
deleteDocumentType(java.lang.String documentTypeId)
Deletes a given document type from managed indices.void
deleteIndex(java.util.Locale locale)
Deletes the indices related to the given locale.void
deleteLegacyIndicesTemplates()
Delete the all legacy index templates.void
destroy()
Destroy this repository and performs any required resource freeing.protected <R extends org.elasticsearch.action.DocWriteRequest<R>>
voidexecuteAsync(R request)
Executes the given request in an asynchronous way (using a bulk processor).protected <R extends org.elasticsearch.action.DocWriteRequest<R>>
voidexecuteAsync(R request, boolean doFlush)
Executes the given request in an asynchronous way (using a bulk processor).protected org.elasticsearch.action.search.SearchResponse
executeSync(org.elasticsearch.action.search.SearchRequest query)
Executes the given query and return the response.protected <REQ,RESP>
RESPexecuteSync(REQ request, java.util.function.Function<org.elasticsearch.client.RestHighLevelClient,lumis.portal.bigdata.elasticsearch.ElasticsearchIndexer.IResponseSupplier<REQ,RESP>> supplierCreator)
Executes the given request in a synchronous way.protected <REQ,RESP>
RESPexecuteSync(REQ request, lumis.portal.bigdata.elasticsearch.ElasticsearchIndexer.IResponseSupplier<REQ,RESP> supplier)
Executes the given request in a synchronous way.java.util.Collection<java.lang.String>
findDocumentTypesMissingIndices()
Returns the missing indices that are supposed to exist due to existent document types.java.util.Map<java.lang.String,? extends DocumentType>
getAllDocumentTypes()
Returns all document types, indexed by document type identifier.java.lang.String[]
getAllIndicesNames(DocumentType type)
Return all portal indices names for a type - for each locale - include null - generate a index name.java.util.List<java.lang.String>
getAutoCompleteSuggestions(SearchQuery searchQuery, AutoCompleteSuggestionConfig autoCompleteSuggestion)
Returns a list of auto complete suggestions for the given auto complete suggestion configuration and the search query.protected org.elasticsearch.action.search.SearchRequest
getBaseQuery(SearchQuery searchQuery)
Returns a search request builder based on the givenSearchQuery
.BulkProcessor
getBulkProcessor()
Returns an internal bulk processor used by this repository.org.elasticsearch.client.RestHighLevelClient
getDelegate()
Returns the underlying Elasticsearch client of this repository.DocumentType
getDocumentType(java.lang.String documentTypeId)
Returns the document type of the given identifier.DocumentType
getDocumentTypeByIndex(java.lang.String index)
Return theDocumentType
for index name.DocumentTypeField
getDocumentTypeField(java.lang.String documentTypeFieldFullId)
Return the document type field of the field that has the given identifier.org.elasticsearch.action.search.SearchRequest
getElasticsearchQuery(SearchQuery searchQuery)
Returns the Elasticsearch search query for the givenSearchQuery
.java.lang.String
getIndexTemplateSettings(java.util.Locale locale)
Returns the index template settings for the given locale.java.lang.String[]
getIndices(SearchQuery searchQuery)
Returns the indices to be used for a search query.org.elasticsearch.index.query.QueryBuilder
getQueryBuilder(SearchQuery searchQuery)
Generates a Elasticsearch'sQueryBuilder
initialized according to a LumisXP'sSearchQuery
.org.elasticsearch.client.RequestOptions
getRequestOptions()
Returns the default request options.java.lang.String
getRetiredAliasName()
Returns the alias used for LumisXP indices that were used in previous versions but are no longer used in current version.java.lang.String
getSearchAliasName()
Returns the alias used for searching in LumisXP indices.java.util.Map<java.util.Locale,IFile>
getSynonymsFiles()
Return a map with all files that the portal need to create based the Locales of synonyms and Locales of portal.void
init(java.lang.String repositoryId)
Initializes this repository using the givennode
as configuration.Document
readDocument(DocumentType documentType, java.util.Locale locale, java.lang.String documentId)
Reads a document from the repository with the given specifications.void
refreshIndices(java.lang.String documentTypeId, java.util.Locale... locales)
Refresh the indices of the given document type.void
refreshIndices(java.util.Collection<java.lang.String> documentTypeIds, java.util.Locale... locales)
Refresh the indices of the given document type.void
refreshIndices(DocumentType documentType, java.util.Locale... locales)
Refresh the indices of the given document type.void
reloadSynonyms()
Reloads the synonyms in this repository.ISearchResults
search(SearchQuery searchQuery)
Runs the givensearch query
and returns thesearch results
.<T> java.util.List<T>
searchUsingScroll(org.elasticsearch.action.search.SearchRequest query, int startAt, int maxResults, java.util.function.Function<org.elasticsearch.action.search.SearchResponse,java.util.List<T>> collector)
Performs the searching using scroll and collect data from all ranges.IBatchIndexer
startBatch()
Returns an indexer to perform bulk actions.
The caller must assureIBatchIndexer.close()
is called after the desired bulk operations were performed.void
updateDocumentsByQuerySync(SearchQuery searchQuery, java.util.Map<java.lang.String,java.lang.Object> fieldValues)
Updates documents that matches aSearchQuery
updating their field values according to thefieldValues
map.void
validate(SearchQuery searchQuery)
Checks is the givensearch query
is syntactically correct.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.portal.bigdata.IBigDataIndexer
addDocument, addOrUpdateDocument, deleteDocument, deleteDocumentsByFieldValue, deleteDocumentsByFieldValue, updateDocumentsByQuerySync
-
-
-
-
Field Detail
-
NATIVE_TEMPLATES_SYNONYMS_LOCALES
public static final java.util.List<java.util.Locale> NATIVE_TEMPLATES_SYNONYMS_LOCALES
-
client
protected org.elasticsearch.client.RestHighLevelClient client
-
bulkProcessor
protected BulkProcessor bulkProcessor
TheBulkProcessor
instance shared withIBatchIndexer
generated by this repository.- Since:
- 8.1.0
- See Also:
startBatch()
-
requestOptions
protected org.elasticsearch.client.RequestOptions requestOptions
-
repository
protected ElasticsearchRepository repository
-
-
Method Detail
-
init
public void init(java.lang.String repositoryId)
Description copied from interface:IBigDataRepositorySPI
Initializes this repository using the givennode
as configuration.- Specified by:
init
in interfaceIBigDataRepositorySPI
- Parameters:
repositoryId
- the repository identifier.
-
deleteLegacyIndicesTemplates
public void deleteLegacyIndicesTemplates()
Delete the all legacy index templates.- Since:
- 14.2.0
-
getSearchAliasName
public java.lang.String getSearchAliasName()
Returns the alias used for searching in LumisXP indices.- Returns:
- the alias.
- Since:
- 8.2.1
-
getRetiredAliasName
public java.lang.String getRetiredAliasName()
Returns the alias used for LumisXP indices that were used in previous versions but are no longer used in current version.This method is intended for use by special upgrade tasks so they can find the indices with previous versions data so they can convert them to current format.
- Returns:
- the alias.
- Since:
- 11.0.0
-
addIndex
public void addIndex(java.util.Locale locale)
Adds the indices relative to the given locale in Elasticsearch.- Parameters:
locale
- the locale the indices to be created refers to.- Since:
- 8.1.0
-
deleteIndex
public void deleteIndex(java.util.Locale locale)
Deletes the indices related to the given locale.- Parameters:
locale
- the locale.- Since:
- 8.1.0
-
getIndexTemplateSettings
public java.lang.String getIndexTemplateSettings(java.util.Locale locale)
Returns the index template settings for the given locale.- Parameters:
locale
- the locale ornull
for locale agnostic settings.- Returns:
- the index template settings for the given locale.
- Since:
- 8.2.1
-
destroy
public void destroy()
Description copied from interface:IBigDataRepositorySPI
Destroy this repository and performs any required resource freeing.- Specified by:
destroy
in interfaceIBigDataRepositorySPI
-
addOrUpdateDocumentType
@Deprecated public void addOrUpdateDocumentType(DocumentType documentType)
Deprecated.Description copied from interface:IBigDataRepository
Adds or updates a document type into managed indices.
If the managed indices couldn't be updated in underlying big data repository, they will be recreated, causing data loss.- Specified by:
addOrUpdateDocumentType
in interfaceIBigDataRepository
- Parameters:
documentType
- the document type to be added.- See Also:
DocumentTypes
-
addOrUpdateDocumentType
public void addOrUpdateDocumentType(DocumentType documentType, boolean force)
Description copied from interface:IBigDataRepository
Adds or updates a document type into managed indices.
If the managed indices couldn't be updated in underlying big data repository:
- If
force
parameter istrue
, they will be recreated, causing data loss. - Else, an
IllegalArgumentException
will be raised.
- Specified by:
addOrUpdateDocumentType
in interfaceIBigDataRepository
- Parameters:
documentType
- the document type to be added.force
- indicates whether the update should be forced.- See Also:
DocumentTypes
- If
-
getAllIndicesNames
public java.lang.String[] getAllIndicesNames(DocumentType type)
Return all portal indices names for a type - for each locale - include null - generate a index name.- Parameters:
typeName
- the type.- Returns:
- all with indexed names.
- Since:
- 11.1.0
-
getIndices
public java.lang.String[] getIndices(SearchQuery searchQuery)
Returns the indices to be used for a search query.- Parameters:
searchQuery
- the search query.- Returns:
- the indices according to
SearchQuery.getDocumentTypeIds()
orgetSearchAliasName()
ifSearchQuery.getDocumentTypeIds()
is empty. - Since:
- 12.5.0
-
deleteDocumentType
public void deleteDocumentType(java.lang.String documentTypeId) throws PortalObjectNotFoundException
Description copied from interface:IBigDataRepository
Deletes a given document type from managed indices.- Specified by:
deleteDocumentType
in interfaceIBigDataRepository
- Parameters:
documentTypeId
- the document type identifier to be deleted.- Throws:
PortalObjectNotFoundException
- if the document type with the given identifier couldn't be found.
-
getDocumentType
public DocumentType getDocumentType(java.lang.String documentTypeId) throws PortalObjectNotFoundException
Description copied from interface:IBigDataRepository
Returns the document type of the given identifier.- Specified by:
getDocumentType
in interfaceIBigDataRepository
- Parameters:
documentTypeId
- the document type identifier.- Returns:
- the document type of the given identifier.
- Throws:
PortalObjectNotFoundException
- if the desired type does not exist.
-
getDocumentTypeByIndex
public DocumentType getDocumentTypeByIndex(java.lang.String index) throws PortalObjectNotFoundException
Return theDocumentType
for index name.- Parameters:
index
- the index name.- Returns:
- the index
DocumentType
- Throws:
PortalObjectNotFoundException
- Since:
- 11.1.0
-
getDocumentTypeField
public DocumentTypeField getDocumentTypeField(java.lang.String documentTypeFieldFullId) throws PortalObjectNotFoundException
Description copied from interface:IBigDataRepository
Return the document type field of the field that has the given identifier.- Specified by:
getDocumentTypeField
in interfaceIBigDataRepository
- Parameters:
documentTypeFieldFullId
- the (full) identifier of the document type field.- Returns:
- the document type field of the field that has the given identifier.
- Throws:
PortalObjectNotFoundException
- if the desired field does not exist.
-
getAllDocumentTypes
public java.util.Map<java.lang.String,? extends DocumentType> getAllDocumentTypes()
Description copied from interface:IBigDataRepositorySPI
Returns all document types, indexed by document type identifier.- Specified by:
getAllDocumentTypes
in interfaceIBigDataRepositorySPI
- Returns:
- all document types, indexed by document type identifier.
- Since:
- 8.1.0
-
readDocument
public Document readDocument(DocumentType documentType, java.util.Locale locale, java.lang.String documentId) throws PortalObjectNotFoundException
Description copied from interface:IBigDataRepository
Reads a document from the repository with the given specifications.- Specified by:
readDocument
in interfaceIBigDataRepository
- Parameters:
documentType
- the document's type.locale
- the document's locale as set in its standard locale field. Must benull
if the document does not have a locale specified.documentId
- the document's identifier.- Returns:
- the document.
- Throws:
PortalObjectNotFoundException
- if no matching document was found.
-
startBatch
public IBatchIndexer startBatch()
Description copied from interface:IBigDataRepository
Returns an indexer to perform bulk actions.
The caller must assureIBatchIndexer.close()
is called after the desired bulk operations were performed.Example of usage:
IBatchIndexer batchIndexer = myBigDataRepository.startBatch(); try { // batch operations here } finally { batchIndexer.close(); }
Or using try-with-resources:
try(IBatchIndexer batchIndexer = myBigDataRepository.startBatch()) { // batch operations here } - Specified by:
startBatch
in interfaceIBigDataRepository
- Returns:
- an indexer to perform bulk actions.
-
deleteDocumentsByQuery
public void deleteDocumentsByQuery(SearchQuery searchQuery)
Description copied from interface:IBigDataIndexer
Deletes documents that are matched by the given search query.
The search query'ssorts
,initial hit
andmaximum hit count
will be ignored.- Specified by:
deleteDocumentsByQuery
in interfaceIBigDataIndexer
- Parameters:
searchQuery
- the search query.
-
search
public ISearchResults search(SearchQuery searchQuery)
Description copied from interface:IBigDataSearcher
Runs the givensearch query
and returns thesearch results
.- Specified by:
search
in interfaceIBigDataSearcher
- Parameters:
searchQuery
- the query to run.- Returns:
- the search results.
-
getElasticsearchQuery
public org.elasticsearch.action.search.SearchRequest getElasticsearchQuery(SearchQuery searchQuery)
Returns the Elasticsearch search query for the givenSearchQuery
.- Parameters:
searchQuery
- the search query.- Returns:
- the Elasticsearch search query for the given
SearchQuery
.
-
searchUsingScroll
public <T> java.util.List<T> searchUsingScroll(org.elasticsearch.action.search.SearchRequest query, int startAt, int maxResults, java.util.function.Function<org.elasticsearch.action.search.SearchResponse,java.util.List<T>> collector)
Performs the searching using scroll and collect data from all ranges.- Parameters:
query
- the query.startAt
- the start at position (1-based).maxResults
- maximum results of query.collector
- the function interface that will collect from response the required data.- Returns:
- the required data.
- Since:
- 11.2.0
-
getAutoCompleteSuggestions
public java.util.List<java.lang.String> getAutoCompleteSuggestions(SearchQuery searchQuery, AutoCompleteSuggestionConfig autoCompleteSuggestion)
Description copied from interface:IBigDataSearcher
Returns a list of auto complete suggestions for the given auto complete suggestion configuration and the search query.- Specified by:
getAutoCompleteSuggestions
in interfaceIBigDataSearcher
- Parameters:
searchQuery
- the search query the auto complete request will be based on.autoCompleteSuggestion
- the auto complete suggestion request.- Returns:
- a list of auto complete suggestions for the given auto complete suggestion request.
-
validate
public void validate(SearchQuery searchQuery) throws PortalException
Description copied from interface:IBigDataSearcher
Checks is the givensearch query
is syntactically correct.- Specified by:
validate
in interfaceIBigDataSearcher
- Parameters:
searchQuery
- thesearch query
to be validated- Throws:
PortalException
- if there is a syntax error in query.
-
getDelegate
public org.elasticsearch.client.RestHighLevelClient getDelegate()
Returns the underlying Elasticsearch client of this repository.- Specified by:
getDelegate
in interfaceIBigDataRepository
- Returns:
- the underlying Elasticsearch client of this repository.
-
getBulkProcessor
public BulkProcessor getBulkProcessor()
Returns an internal bulk processor used by this repository.- Returns:
- bulk processor.
- Since:
- 11.0.0
-
reloadSynonyms
public void reloadSynonyms() throws AccessDeniedException, PortalException
Description copied from interface:IBigDataRepositorySPI
Reloads the synonyms in this repository.- Specified by:
reloadSynonyms
in interfaceIBigDataRepositorySPI
- Throws:
AccessDeniedException
- if user doesn't have the appropriate permission.PortalException
- if some error occur.
-
getSynonymsFiles
public java.util.Map<java.util.Locale,IFile> getSynonymsFiles()
Description copied from interface:IBigDataRepositorySPI
Return a map with all files that the portal need to create based the Locales of synonyms and Locales of portal.- Specified by:
getSynonymsFiles
in interfaceIBigDataRepositorySPI
- Returns:
- a map that key is Locale, and, value is your file.
-
refreshIndices
public void refreshIndices(DocumentType documentType, java.util.Locale... locales)
Refresh the indices of the given document type. If no locale is passed, all indices of the given document type will be refreshed.- Parameters:
documentType
- the document type.locales
- the locales.- Since:
- 12.0.0
-
refreshIndices
public void refreshIndices(java.lang.String documentTypeId, java.util.Locale... locales)
Refresh the indices of the given document type. If no locale is passed, all indices of the given document type will be refreshed.- Parameters:
documentType
- the document type.locales
- the locales.- Since:
- 12.0.0
-
refreshIndices
public void refreshIndices(java.util.Collection<java.lang.String> documentTypeIds, java.util.Locale... locales)
Refresh the indices of the given document type. If no locale is passed, all indices of the given document type will be refreshed.- Parameters:
documentTypeIds
- the document type identifiers.locales
- the locales.- Since:
- 12.2.0
-
getRequestOptions
public org.elasticsearch.client.RequestOptions getRequestOptions()
Returns the default request options.- Returns:
- the default request options.
- Since:
- 14.0.0
-
findDocumentTypesMissingIndices
public java.util.Collection<java.lang.String> findDocumentTypesMissingIndices()
Description copied from interface:IBigDataRepositorySPI
Returns the missing indices that are supposed to exist due to existent document types.- Specified by:
findDocumentTypesMissingIndices
in interfaceIBigDataRepositorySPI
- Returns:
- a collection with the missing indices name, or an empty collection if there is no index missing.
-
addDocument
public void addDocument(Document document)
Description copied from interface:IBigDataIndexer
Adds a document to the index. If in the index already exists a document with the same document type, identifier and locale then this operation will fail (probably without throwing any exception, since the fail may occur in background as this method may be asynchronous).- Specified by:
addDocument
in interfaceIBigDataIndexer
- Parameters:
document
- thedocument
to be added.- See Also:
IBigDataIndexer.addOrUpdateDocument(Document)
-
addDocumentToIndexQueue
public void addDocumentToIndexQueue(Document document)
Adds a document that may be delayed until it is indexed.- Parameters:
document
- the document.- Since:
- 11.0.0
-
addOrUpdateDocument
public void addOrUpdateDocument(Document document)
Description copied from interface:IBigDataIndexer
Adds or updates a document on the index. If in the index already exists a document with the same document type, identifier and locale then the document on the index will be replaced by the given document; otherwise the given document will be added to the index.- Specified by:
addOrUpdateDocument
in interfaceIBigDataIndexer
- Parameters:
document
- thedocument
to be added.- See Also:
IBigDataIndexer.addDocument(Document)
-
deleteDocument
public void deleteDocument(DocumentType documentType, java.util.Locale locale, java.lang.String documentId)
Description copied from interface:IBigDataIndexer
Deletes a document from the index with the given specifications. If no such document exists, this method does nothing.- Specified by:
deleteDocument
in interfaceIBigDataIndexer
- Parameters:
documentType
- the document's type.locale
- the document's locale as set in its standard locale field. Must benull
if the document does not have a locale specified.documentId
- the document's identifier.
-
deleteDocumentsByFieldValue
public void deleteDocumentsByFieldValue(java.lang.String fieldId, java.lang.Object... values)
Description copied from interface:IBigDataIndexer
Deletes documents that are matched by one of the given values in the field of given field identifier.- Specified by:
deleteDocumentsByFieldValue
in interfaceIBigDataIndexer
- Parameters:
fieldId
- the field identifier.values
- the values.
-
deleteDocumentsByFieldValue
public void deleteDocumentsByFieldValue(java.lang.String fieldId, java.util.Collection<?> values)
Description copied from interface:IBigDataIndexer
Deletes documents that are matched by one of the given values in the field of given field identifier.- Specified by:
deleteDocumentsByFieldValue
in interfaceIBigDataIndexer
- Parameters:
fieldId
- the field identifier.values
- the values.
-
updateDocumentsByQuerySync
public void updateDocumentsByQuerySync(SearchQuery searchQuery, java.util.Map<java.lang.String,java.lang.Object> fieldValues)
Description copied from interface:IBigDataIndexer
Updates documents that matches aSearchQuery
updating their field values according to thefieldValues
map.This operation is synchronous in relation to the completion of the update execution. Searches performed after this method returns may not reflect the update, since internal optimizations and behavior of the underlying big data storage may demand some time for the update to be visible to searches.
- Specified by:
updateDocumentsByQuerySync
in interfaceIBigDataIndexer
- Parameters:
searchQuery
- the search query.fieldValues
- a map where the key is a field's full identifier and the value is the value to be set on the corresponding field. The value must be of a type compatible with the field type. If the value isnull
,
-
getBaseQuery
protected org.elasticsearch.action.search.SearchRequest getBaseQuery(SearchQuery searchQuery)
Returns a search request builder based on the givenSearchQuery
. Does not add sort, aggregations, start at and max rows.- Parameters:
searchQuery
- the search query.- Returns:
- a search request builder based on the given
SearchQuery
. - Since:
- 8.1.0
-
getQueryBuilder
public org.elasticsearch.index.query.QueryBuilder getQueryBuilder(SearchQuery searchQuery)
Generates a Elasticsearch'sQueryBuilder
initialized according to a LumisXP'sSearchQuery
.- Parameters:
searchQuery
- the LumisXP's search query.- Returns:
- the Elasticsearch's query builder.
- Since:
- 11.0.0
-
executeSync
protected <REQ,RESP> RESP executeSync(REQ request, java.util.function.Function<org.elasticsearch.client.RestHighLevelClient,lumis.portal.bigdata.elasticsearch.ElasticsearchIndexer.IResponseSupplier<REQ,RESP>> supplierCreator)
Executes the given request in a synchronous way.- Type Parameters:
REQ
-RESP
-- Parameters:
request
- the requestsupplier
- the response supplier (the code that actually performs the request)- Returns:
- the response
- Since:
- 14.0.0
-
executeSync
protected <REQ,RESP> RESP executeSync(REQ request, lumis.portal.bigdata.elasticsearch.ElasticsearchIndexer.IResponseSupplier<REQ,RESP> supplier)
Executes the given request in a synchronous way.- Type Parameters:
REQ
-RESP
-- Parameters:
request
- the requestsupplier
- the response supplier (the code that actually performs the request)- Returns:
- the response
- Since:
- 14.0.0
-
executeSync
protected org.elasticsearch.action.search.SearchResponse executeSync(org.elasticsearch.action.search.SearchRequest query)
Executes the given query and return the response.- Parameters:
query
- the query- Returns:
- the response
- Since:
- 14.0.0
-
executeAsync
protected <R extends org.elasticsearch.action.DocWriteRequest<R>> void executeAsync(R request)
Executes the given request in an asynchronous way (using a bulk processor).- Type Parameters:
R
-- Parameters:
request
- the request- Since:
- 14.0.0
-
executeAsync
protected <R extends org.elasticsearch.action.DocWriteRequest<R>> void executeAsync(R request, boolean doFlush)
Executes the given request in an asynchronous way (using a bulk processor).- Type Parameters:
R
-- Parameters:
request
- the requestdoFlush
- indicates whether the bulk processor should be flushed- Since:
- 14.0.0
-
-