Class Elastic
java.lang.Object
fr.paris.lutece.plugins.libraryelastic.util.Elastic
Elastic
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a document of given type into a given indexCreate a document of given type into a given index at the given idcreateByBulk(String strIndex, BulkRequest bulkRequest) perform a bulk indexing of documents : this is used for indexing thousand doc with one HTTP callcreateMappings(String strIndex, String strJsonMappings) deleteByQuery(String strIndex, String strQuery) Delete a documents by QuerydeleteDocument(String strIndex, String strId) Delete a document based on its id in the indexdeleteIndex(String strIndex) Delete a given indexbooleanCheck if a given index existspartialUpdate(String strIndex, String strId, Object object) Partial Updates to Documentssearch(String strIndex, SearchRequest search) Search a document of given type into a given indexSearchsuggest(String strIndex, AbstractSuggestRequest suggest) suggest a list of document of given type into a given index The suggest is done with a _search request with size set to 0 to avoid fetch in 'hits' so be careful with the JSON resultsuggest a list of document of given type into a given index The suggest is done with a _search request with size set to 0 to avoid fetch in 'hits' so be careful with the JSON result
-
Constructor Details
-
Elastic
Constructor- Parameters:
strServerUrl- The Elastic server URL
-
Elastic
Basic Authentification constructor- Parameters:
strServerUrl- The Elastic server URLstrServerLogin- LoginstrServerPwd- Password
-
-
Method Details
-
create
Create a document of given type into a given index- Parameters:
strIndex- The indexobject- The document- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
create
Create a document of given type into a given index at the given id- Parameters:
strIndex- The indexstrId- The document idobject- The document- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
createByBulk
perform a bulk indexing of documents : this is used for indexing thousand doc with one HTTP call- Parameters:
strIndex- the elk index namebulkRequest- the bulkRequest- Returns:
- the reponse of Elk server
- Throws:
ElasticClientException
-
deleteIndex
Delete a given index- Parameters:
strIndex- The index- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
deleteDocument
Delete a document based on its id in the index- Parameters:
strIndex- The indexstrId- The id- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
deleteByQuery
Delete a documents by Query- Parameters:
strIndex- The indexstrQuery- The Query- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
partialUpdate
public String partialUpdate(String strIndex, String strId, Object object) throws ElasticClientException Partial Updates to Documents- Parameters:
strIndex- The indexstrId- The document idobject- The document- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
isExists
Check if a given index exists- Parameters:
strIndex- The index- Returns:
- if th index exists
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
search
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
-
search
Search- Parameters:
strIndex- The indexstrSearchRequest- search request- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
suggest
public String suggest(String strIndex, AbstractSuggestRequest suggest) throws ElasticClientException suggest a list of document of given type into a given index The suggest is done with a _search request with size set to 0 to avoid fetch in 'hits' so be careful with the JSON result- Parameters:
strIndex- The indexsuggest- suggest request- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
suggest
suggest a list of document of given type into a given index The suggest is done with a _search request with size set to 0 to avoid fetch in 'hits' so be careful with the JSON result- Parameters:
strIndex- The indexstrJSON- suggest request- Returns:
- The JSON response from Elastic
- Throws:
ElasticClientException- If a problem occurs connecting Elastic
-
createMappings
- Parameters:
strIndex-strJsonMappings-- Returns:
- Throws:
ElasticClientException
-