Class ElasticIndexingClient
- java.lang.Object
-
- org.exoplatform.commons.search.es.client.ElasticClient
-
- org.exoplatform.commons.search.es.client.ElasticIndexingClient
-
public class ElasticIndexingClient extends ElasticClient
Created by The eXo Platform SAS Author : Thibault Clement tclement@exoplatform.com 9/1/15
-
-
Field Summary
Fields Modifier and Type Field Description static StringEMPTY_JSON-
Fields inherited from class org.exoplatform.commons.search.es.client.ElasticClient
auditTrail, client, DEFAULT_MAX_HTTP_POOL_CONNECTIONS, urlClient
-
-
Constructor Summary
Constructors Constructor Description ElasticIndexingClient(ElasticIndexingAuditTrail auditTrail)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.http.conn.HttpClientConnectionManagergetClientConnectionManager()protected StringgetEsPasswordProperty()protected StringgetEsUsernameProperty()protected intgetMaxConnections()protected voidresetMaxConnections()longsendCountIndexObjectsRequest(String index)Send request to ES to count all documents found in indexvoidsendCreateAttachmentPipelineRequest(String index, String pipelineName, String processorMappings)Send request to ES to create a new Ingest pipeline for attachmentvoidsendCreateDocOnPipeline(String index, String id, String pipelineName, String pipelineRequestOperation)Send request to ES to create a new Ingest pipeline for attachmentvoidsendCreateIndexAliasRequest(String index, String oldIndex, String indexAlias)Send request to ES to create a new index alias for new ES Index and remove it from old index if existsbooleansendCreateIndexRequest(String index, String settings, String mappings)Send request to ES to create a new indexvoidsendCUDRequest(String bulkRequest)Send request to ES to perform a C-reate, U-pdate or D-elete operation on a ES documentvoidsendDeleteIndexRequest(String index)Deletes an index from ESStringsendGetESVersion()Send request to ES to get versionSet<String>sendGetIndexAliasesRequest(String index)Send request to ES to get index aliasesbooleansendIsIndexExistsRequest(String index)Send request to ES to test if index existsvoidsendReindexTypeRequest(String index, String oldIndex, String type, String pipeline)This operation reindex the documents from old index/type to new index/type mapping.-
Methods inherited from class org.exoplatform.commons.search.es.client.ElasticClient
getHttpClient, initHttpClient, sendHttpDeleteRequest, sendHttpGetRequest, sendHttpHeadRequest, sendHttpPostRequest, sendHttpPutRequest
-
-
-
-
Field Detail
-
EMPTY_JSON
public static final String EMPTY_JSON
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ElasticIndexingClient
public ElasticIndexingClient(ElasticIndexingAuditTrail auditTrail)
-
-
Method Detail
-
sendCreateIndexRequest
public boolean sendCreateIndexRequest(String index, String settings, String mappings)
Send request to ES to create a new index
-
sendCUDRequest
public void sendCUDRequest(String bulkRequest)
Send request to ES to perform a C-reate, U-pdate or D-elete operation on a ES document- Parameters:
bulkRequest- JSON containing C-reate, U-pdate or D-elete operation
-
sendCreateAttachmentPipelineRequest
public void sendCreateAttachmentPipelineRequest(String index, String pipelineName, String processorMappings)
Send request to ES to create a new Ingest pipeline for attachment- Parameters:
index-pipelineName-processorMappings-
-
sendCreateDocOnPipeline
public void sendCreateDocOnPipeline(String index, String id, String pipelineName, String pipelineRequestOperation)
Send request to ES to create a new Ingest pipeline for attachment- Parameters:
index-id-pipelineName-pipelineRequestOperation-
-
sendCreateIndexAliasRequest
public void sendCreateIndexAliasRequest(String index, String oldIndex, String indexAlias)
Send request to ES to create a new index alias for new ES Index and remove it from old index if exists
-
sendGetIndexAliasesRequest
public Set<String> sendGetIndexAliasesRequest(String index)
Send request to ES to get index aliases
-
sendCountIndexObjectsRequest
public long sendCountIndexObjectsRequest(String index)
Send request to ES to count all documents found in index
-
sendGetESVersion
public String sendGetESVersion()
Send request to ES to get version
-
sendDeleteIndexRequest
public void sendDeleteIndexRequest(String index)
Deletes an index from ES- Parameters:
index- index name to delete
-
sendReindexTypeRequest
public void sendReindexTypeRequest(String index, String oldIndex, String type, String pipeline)
This operation reindex the documents from old index/type to new index/type mapping. A pipeline could be used when reindexing in case Ingest Attachment plugin is used by a target type.- Parameters:
index- target index nameoldIndex- source index nametype- source type namepipeline- target pipeline name (optional)
-
sendIsIndexExistsRequest
public boolean sendIsIndexExistsRequest(String index)
Send request to ES to test if index exists- Parameters:
index- ES index- Returns:
- true if index exists in ES
-
getEsUsernameProperty
protected String getEsUsernameProperty()
- Specified by:
getEsUsernamePropertyin classElasticClient
-
getEsPasswordProperty
protected String getEsPasswordProperty()
- Specified by:
getEsPasswordPropertyin classElasticClient
-
getClientConnectionManager
protected org.apache.http.conn.HttpClientConnectionManager getClientConnectionManager()
- Specified by:
getClientConnectionManagerin classElasticClient
-
getMaxConnections
protected int getMaxConnections()
- Overrides:
getMaxConnectionsin classElasticClient
-
resetMaxConnections
protected void resetMaxConnections()
-
-