public class ElasticClient extends Object
| Constructor and Description |
|---|
ElasticClient(String strServerUrl)
Constructor
|
ElasticClient(String strServerUrl,
String strServerLogin,
String strServerPwd)
Basic Authentification constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
create(String strIndex,
Object object)
Create a document of given type into a given index
|
String |
create(String strIndex,
String strId,
Object object)
Create a document of given type into a given index at the given id
|
String |
createAlias(String strIndex,
String alias) |
String |
createMappings(String strIndex,
String strJsonMappings) |
String |
deleteAlias(String strIndex,
String alias) |
String |
deleteByQuery(String strIndex,
String strQuery)
Delete a documents by Query
|
String |
deleteDocument(String strIndex,
String strId)
Delete a document based on its id in the index
|
String |
deleteIndex(String strIndex)
Delete a given index
|
String |
get(String strIndex,
String strId)
Search
|
String |
getAlias(String alias) |
String |
indexByBulk(String strIndex,
List<BulkAction> bulkActions)
perform a bulk indexing of documents : this is used for indexing thousand doc with one HTTP call
|
boolean |
isAlive() |
boolean |
isExists(String strIndex)
Check if a given index exists
|
String |
search(String strIndex,
Object search)
Search a document of given type into a given index
|
String |
search(String strIndex,
String searchRequest)
Search
|
String |
suggest(String strIndex,
String strJSON)
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
|
String |
update(String strIndex,
String strId,
Object object)
Partial Updates to Documents
|
String |
updateSettings(String strIndex,
String strJsonSettings) |
public ElasticClient(String strServerUrl)
strServerUrl - The Elastic server URLpublic String create(String strIndex, Object object) throws ElasticClientException
strIndex - The indexobject - The documentElasticClientException - If a problem occurs connecting Elasticpublic String create(String strIndex, String strId, Object object) throws ElasticClientException
strIndex - The indexstrId - The document idobject - The documentElasticClientException - If a problem occurs connecting Elasticpublic String indexByBulk(String strIndex, List<BulkAction> bulkActions) throws ElasticClientException
strIndex - the elk index namebulkActions - the actionsElasticClientExceptionpublic String deleteIndex(String strIndex) throws ElasticClientException
strIndex - The indexElasticClientException - If a problem occurs connecting Elasticpublic String deleteDocument(String strIndex, String strId) throws ElasticClientException
strIndex - The indexstrId - The idElasticClientException - If a problem occurs connecting Elasticpublic String deleteByQuery(String strIndex, String strQuery) throws ElasticClientException
strIndex - The indexstrQuery - The QueryElasticClientException - If a problem occurs connecting Elasticpublic String update(String strIndex, String strId, Object object) throws ElasticClientException
strIndex - The indexstrId - The document idobject - The documentElasticClientException - If a problem occurs connecting Elasticpublic String get(String strIndex, String strId) throws ElasticClientException
strIndex - The indexstrId - the id of the requested documentElasticClientException - If a problem occurs connecting Elasticpublic boolean isExists(String strIndex) throws ElasticClientException
strIndex - The indexElasticClientException - If a problem occurs connecting Elasticpublic String search(String strIndex, Object search) throws ElasticClientException
strIndex - The indexsearch - search requestElasticClientException - If a problem occurs connecting Elasticpublic String search(String strIndex, String searchRequest) throws ElasticClientException
strIndex - The indexsearchRequest - search requestElasticClientException - If a problem occurs connecting Elasticpublic String suggest(String strIndex, String strJSON) throws ElasticClientException
strIndex - The indexstrJSON - suggest requestElasticClientException - If a problem occurs connecting Elasticpublic String createMappings(String strIndex, String strJsonMappings) throws ElasticClientException
strIndex - strJsonMappings - ElasticClientExceptionpublic String updateSettings(String strIndex, String strJsonSettings) throws ElasticClientException
strIndex - strJsonSettings - ElasticClientExceptionpublic String createAlias(String strIndex, String alias) throws ElasticClientException
strIndex - alias - ElasticClientExceptionpublic String getAlias(String alias) throws ElasticClientException
alias - ElasticClientExceptionpublic String deleteAlias(String strIndex, String alias) throws ElasticClientException
strIndex - alias - ElasticClientExceptionpublic boolean isAlive()
Copyright © 2023 City of Paris. All rights reserved.