Class ElasticClient
- java.lang.Object
-
- fr.paris.lutece.plugins.identitystore.service.indexer.elastic.client.ElasticClient
-
public class ElasticClient extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ElasticClient(java.lang.String strServerUrl)ConstructorElasticClient(java.lang.String strServerUrl, java.lang.String strServerLogin, java.lang.String strServerPwd)Basic Authentification constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAliasOnIndex(AliasActions aliasActions)booleanaliasExists(java.lang.String strAlias)Check if a given alias existsvoidcreate(java.lang.String strIndex, java.lang.String strId, java.lang.Object object)Create a document of given type into a given index at the given idvoidcreateMappings(java.lang.String strIndex, java.lang.String strJsonMappings)voiddeleteAlias(java.lang.String strIndex, java.lang.String alias)voiddeleteDocument(java.lang.String strIndex, java.lang.String strId)Delete a document based on its id in the indexvoiddeleteIndex(java.lang.String strIndex)Delete a given indexjava.lang.Stringget(java.lang.String strIndex, java.lang.String strId)java.lang.StringgetAlias(java.lang.String alias)java.lang.StringgetIndexedIdentitiesNumber(java.lang.String strIndex)voidindexByBulk(java.lang.String strIndex, java.util.List<BulkAction> bulkActions)perform a bulk indexing of documents : this is used for indexing thousand doc with one HTTP callbooleanisAlive()booleanisExists(java.lang.String strIndex)Check if a given index existsbooleanisWriteable(java.lang.String strIndex)Check if a given index is not in read only modeResponsesmultiSearch(java.lang.String strIndex, java.util.List<MultiSearchAction> searchActions)perform a multi search of documents : used to perform several query with a single http callResponsesearch(java.lang.String strIndex, java.lang.Object search)Search a document of given type into a given indexvoidupdate(java.lang.String strIndex, java.lang.String strId, java.lang.Object object)Partial Updates to DocumentsvoidupdateSettings(java.lang.String strIndex, java.lang.String strJsonSettings)
-
-
-
Constructor Detail
-
ElasticClient
public ElasticClient(java.lang.String strServerUrl)
Constructor- Parameters:
strServerUrl- The Elastic server URL
-
ElasticClient
public ElasticClient(java.lang.String strServerUrl, java.lang.String strServerLogin, java.lang.String strServerPwd)Basic Authentification constructor- Parameters:
strServerUrl- The Elastic server URLstrServerLogin- LoginstrServerPwd- Password
-
-
Method Detail
-
create
public void create(java.lang.String strIndex, java.lang.String strId, java.lang.Object object) throws ElasticClientExceptionCreate a document of given type into a given index at the given id- Parameters:
strIndex- The indexstrId- The document idobject- The document- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
indexByBulk
public void indexByBulk(java.lang.String strIndex, java.util.List<BulkAction> bulkActions) throws ElasticClientExceptionperform a bulk indexing of documents : this is used for indexing thousand doc with one HTTP call- Parameters:
strIndex- the elk index namebulkActions- the actions- Throws:
ElasticClientException
-
deleteIndex
public void deleteIndex(java.lang.String strIndex) throws ElasticClientExceptionDelete a given index- Parameters:
strIndex- The index- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
deleteDocument
public void deleteDocument(java.lang.String strIndex, java.lang.String strId) throws ElasticClientExceptionDelete a document based on its id in the index- Parameters:
strIndex- The indexstrId- The id- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
update
public void update(java.lang.String strIndex, java.lang.String strId, java.lang.Object object) throws ElasticClientExceptionPartial Updates to Documents- Parameters:
strIndex- The indexstrId- The document idobject- The document- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
get
public java.lang.String get(java.lang.String strIndex, java.lang.String strId) throws ElasticClientException- Parameters:
strIndex- the index of the documentstrId- the id of the document- Returns:
- the document if any
- Throws:
ElasticClientException
-
isExists
public boolean isExists(java.lang.String strIndex) throws ElasticClientExceptionCheck if a given index exists- Parameters:
strIndex- The index- Returns:
- if th index exists
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
isWriteable
public boolean isWriteable(java.lang.String strIndex)
Check if a given index is not in read only mode- Parameters:
strIndex- The index- Returns:
- true if the index exists and is writable
-
search
public Response search(java.lang.String strIndex, java.lang.Object search) throws ElasticClientException
Search a document of given type into a given index- Parameters:
strIndex- The indexsearch- search request- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
multiSearch
public Responses multiSearch(java.lang.String strIndex, java.util.List<MultiSearchAction> searchActions) throws ElasticClientException
perform a multi search of documents : used to perform several query with a single http call- Parameters:
strIndex- the elk index namesearchActions- the actions- Returns:
- the reponse of Elk server
- Throws:
ElasticClientException
-
createMappings
public void createMappings(java.lang.String strIndex, java.lang.String strJsonMappings) throws ElasticClientException- Parameters:
strIndex-strJsonMappings-- Throws:
ElasticClientException
-
updateSettings
public void updateSettings(java.lang.String strIndex, java.lang.String strJsonSettings) throws ElasticClientException- Parameters:
strIndex-strJsonSettings-- Throws:
ElasticClientException
-
addAliasOnIndex
public void addAliasOnIndex(AliasActions aliasActions) throws ElasticClientException
- Parameters:
strIndex-alias-- Throws:
ElasticClientException
-
getAlias
public java.lang.String getAlias(java.lang.String alias) throws ElasticClientException- Parameters:
alias-- Returns:
- Throws:
ElasticClientException
-
aliasExists
public boolean aliasExists(java.lang.String strAlias)
Check if a given alias exists- Parameters:
strAlias- The indexThe alias- Returns:
- if th index exists
-
deleteAlias
public void deleteAlias(java.lang.String strIndex, java.lang.String alias) throws ElasticClientException- Parameters:
strIndex-alias-- Throws:
ElasticClientException
-
getIndexedIdentitiesNumber
public java.lang.String getIndexedIdentitiesNumber(java.lang.String strIndex) throws ElasticClientException- Throws:
ElasticClientException
-
isAlive
public boolean isAlive()
-
-