public class Elastic extends Object
| Constructor and Description |
|---|
Elastic(String strServerUrl)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
create(String strIndex,
String strType,
Object object)
Create a document of given type into a given index
|
String |
create(String strIndex,
String strType,
String strId,
Object object)
Create a document of given type into a given index at the given id
|
String |
createByBulk(String strIndex,
String strType,
BulkRequest bulkRequest)
perform a bulk indexing of documents : this is used for indexing thousand doc with one HTTP call
|
String |
createMappings(String strIndex,
String strJsonMappings) |
String |
deleteDocument(String strIndex,
String strType,
String strId)
Delete a document based on its id in the index
|
String |
deleteIndex(String strIndex)
Delete a given index
|
boolean |
isExists(String strIndex)
Check if a given index exists
|
String |
search(String strIndex,
SearchRequest search)
Search a document of given type into a given index
|
String |
suggest(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 result
|
public Elastic(String strServerUrl)
strServerUrl - The Elastic server URLpublic String create(String strIndex, String strType, Object object) throws ElasticClientException
strIndex - The indexstrType - The document typeobject - The documentElasticClientException - If a problem occurs connecting Elasticpublic String create(String strIndex, String strType, String strId, Object object) throws ElasticClientException
strIndex - The indexstrType - The document typestrId - The document idobject - The documentElasticClientException - If a problem occurs connecting Elasticpublic String createByBulk(String strIndex, String strType, BulkRequest bulkRequest) throws ElasticClientException
strIndex - the elk index namestrType - the type of documentbulkRequest - the bulkRequestElasticClientExceptionpublic String deleteIndex(String strIndex) throws ElasticClientException
strIndex - The indexElasticClientException - If a problem occurs connecting Elasticpublic String deleteDocument(String strIndex, String strType, String strId) throws ElasticClientException
strIndex - The indexstrType - The document typestrId - The idElasticClientException - 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, SearchRequest search) throws ElasticClientException
strIndex - The indexsearch - search requestElasticClientException - If a problem occurs connecting Elasticpublic String suggest(String strIndex, AbstractSuggestRequest suggest) throws ElasticClientException
strIndex - The indexsuggest - suggest requestElasticClientException - If a problem occurs connecting Elasticpublic String createMappings(String strIndex, String strJsonMappings) throws ElasticClientException
strIndex - strJsonMappings - ElasticClientExceptionCopyright © 2017 City of Paris. All rights reserved.