public class RestHighLevelClient
extends java.lang.Object
RestClient
and allows to build requests and read responses.
The provided RestClient
is externally built and closed.
Can be sub-classed to expose additional client methods that make use of endpoints added to Elasticsearch through plugins, or to
add support for custom response sections, again added to Elasticsearch through plugins.Modifier | Constructor and Description |
---|---|
|
RestHighLevelClient(org.elasticsearch.client.RestClient restClient)
Creates a
RestHighLevelClient given the low level RestClient that it should use to perform requests. |
protected |
RestHighLevelClient(org.elasticsearch.client.RestClient restClient,
java.util.List<org.elasticsearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)
Creates a
RestHighLevelClient given the low level RestClient that it should use to perform requests and
a list of entries that allow to parse custom response sections added to Elasticsearch through plugins. |
Modifier and Type | Method and Description |
---|---|
org.elasticsearch.action.bulk.BulkResponse |
bulk(org.elasticsearch.action.bulk.BulkRequest bulkRequest,
org.elasticsearch.client.http.Header... headers)
Executes a bulk request using the Bulk API
See Bulk API on elastic.co
|
void |
bulkAsync(org.elasticsearch.action.bulk.BulkRequest bulkRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.bulk.BulkResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously executes a bulk request using the Bulk API
See Bulk API on elastic.co
|
org.elasticsearch.action.search.ClearScrollResponse |
clearScroll(org.elasticsearch.action.search.ClearScrollRequest clearScrollRequest,
org.elasticsearch.client.http.Header... headers)
Clears one or more scroll ids using the Clear Scroll api
See
Clear Scroll API on elastic.co
|
void |
clearScrollAsync(org.elasticsearch.action.search.ClearScrollRequest clearScrollRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.search.ClearScrollResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously clears one or more scroll ids using the Clear Scroll api
See
Clear Scroll API on elastic.co
|
org.elasticsearch.action.delete.DeleteResponse |
delete(org.elasticsearch.action.delete.DeleteRequest deleteRequest,
org.elasticsearch.client.http.Header... headers)
Deletes a document by id using the Delete api
See Delete API on elastic.co
|
void |
deleteAsync(org.elasticsearch.action.delete.DeleteRequest deleteRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.delete.DeleteResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously deletes a document by id using the Delete api
See Delete API on elastic.co
|
boolean |
exists(org.elasticsearch.action.get.GetRequest getRequest,
org.elasticsearch.client.http.Header... headers)
Checks for the existence of a document.
|
void |
existsAsync(org.elasticsearch.action.get.GetRequest getRequest,
org.elasticsearch.action.ActionListener<java.lang.Boolean> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously checks for the existence of a document.
|
org.elasticsearch.action.get.GetResponse |
get(org.elasticsearch.action.get.GetRequest getRequest,
org.elasticsearch.client.http.Header... headers)
Retrieves a document by id using the Get API
See Get API on elastic.co
|
void |
getAsync(org.elasticsearch.action.get.GetRequest getRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.get.GetResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously retrieves a document by id using the Get API
See Get API on elastic.co
|
org.elasticsearch.action.index.IndexResponse |
index(org.elasticsearch.action.index.IndexRequest indexRequest,
org.elasticsearch.client.http.Header... headers)
Index a document using the Index API
See Index API on elastic.co
|
void |
indexAsync(org.elasticsearch.action.index.IndexRequest indexRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.index.IndexResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously index a document using the Index API
See Index API on elastic.co
|
org.elasticsearch.action.main.MainResponse |
info(org.elasticsearch.client.http.Header... headers)
Get the cluster info otherwise provided when sending an HTTP request to port 9200
|
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> |
performRequest(Req request,
org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter,
org.elasticsearch.common.CheckedFunction<org.elasticsearch.client.Response,Resp,java.io.IOException> responseConverter,
java.util.Set<java.lang.Integer> ignores,
org.elasticsearch.client.http.Header... headers) |
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> |
performRequestAndParseEntity(Req request,
org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter,
org.elasticsearch.common.CheckedFunction<org.elasticsearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser,
java.util.Set<java.lang.Integer> ignores,
org.elasticsearch.client.http.Header... headers) |
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> |
performRequestAsync(Req request,
org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter,
org.elasticsearch.common.CheckedFunction<org.elasticsearch.client.Response,Resp,java.io.IOException> responseConverter,
org.elasticsearch.action.ActionListener<Resp> listener,
java.util.Set<java.lang.Integer> ignores,
org.elasticsearch.client.http.Header... headers) |
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> |
performRequestAsyncAndParseEntity(Req request,
org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter,
org.elasticsearch.common.CheckedFunction<org.elasticsearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser,
org.elasticsearch.action.ActionListener<Resp> listener,
java.util.Set<java.lang.Integer> ignores,
org.elasticsearch.client.http.Header... headers) |
boolean |
ping(org.elasticsearch.client.http.Header... headers)
Pings the remote Elasticsearch cluster and returns true if the ping succeeded, false otherwise
|
org.elasticsearch.action.search.SearchResponse |
search(org.elasticsearch.action.search.SearchRequest searchRequest,
org.elasticsearch.client.http.Header... headers)
Executes a search using the Search api
See Search API on elastic.co
|
void |
searchAsync(org.elasticsearch.action.search.SearchRequest searchRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.search.SearchResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously executes a search using the Search api
See Search API on elastic.co
|
org.elasticsearch.action.search.SearchResponse |
searchScroll(org.elasticsearch.action.search.SearchScrollRequest searchScrollRequest,
org.elasticsearch.client.http.Header... headers)
Executes a search using the Search Scroll api
See Search Scroll
API on elastic.co
|
void |
searchScrollAsync(org.elasticsearch.action.search.SearchScrollRequest searchScrollRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.search.SearchResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously executes a search using the Search Scroll api
See Search Scroll
API on elastic.co
|
org.elasticsearch.action.update.UpdateResponse |
update(org.elasticsearch.action.update.UpdateRequest updateRequest,
org.elasticsearch.client.http.Header... headers)
Updates a document using the Update API
|
void |
updateAsync(org.elasticsearch.action.update.UpdateRequest updateRequest,
org.elasticsearch.action.ActionListener<org.elasticsearch.action.update.UpdateResponse> listener,
org.elasticsearch.client.http.Header... headers)
Asynchronously updates a document using the Update API
|
public RestHighLevelClient(org.elasticsearch.client.RestClient restClient)
RestHighLevelClient
given the low level RestClient
that it should use to perform requests.protected RestHighLevelClient(org.elasticsearch.client.RestClient restClient, java.util.List<org.elasticsearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)
RestHighLevelClient
given the low level RestClient
that it should use to perform requests and
a list of entries that allow to parse custom response sections added to Elasticsearch through plugins.public org.elasticsearch.action.bulk.BulkResponse bulk(org.elasticsearch.action.bulk.BulkRequest bulkRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void bulkAsync(org.elasticsearch.action.bulk.BulkRequest bulkRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.bulk.BulkResponse> listener, org.elasticsearch.client.http.Header... headers)
public boolean ping(org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public org.elasticsearch.action.main.MainResponse info(org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public org.elasticsearch.action.get.GetResponse get(org.elasticsearch.action.get.GetRequest getRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void getAsync(org.elasticsearch.action.get.GetRequest getRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.get.GetResponse> listener, org.elasticsearch.client.http.Header... headers)
public boolean exists(org.elasticsearch.action.get.GetRequest getRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void existsAsync(org.elasticsearch.action.get.GetRequest getRequest, org.elasticsearch.action.ActionListener<java.lang.Boolean> listener, org.elasticsearch.client.http.Header... headers)
public org.elasticsearch.action.index.IndexResponse index(org.elasticsearch.action.index.IndexRequest indexRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void indexAsync(org.elasticsearch.action.index.IndexRequest indexRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.index.IndexResponse> listener, org.elasticsearch.client.http.Header... headers)
public org.elasticsearch.action.update.UpdateResponse update(org.elasticsearch.action.update.UpdateRequest updateRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void updateAsync(org.elasticsearch.action.update.UpdateRequest updateRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.update.UpdateResponse> listener, org.elasticsearch.client.http.Header... headers)
public org.elasticsearch.action.delete.DeleteResponse delete(org.elasticsearch.action.delete.DeleteRequest deleteRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void deleteAsync(org.elasticsearch.action.delete.DeleteRequest deleteRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.delete.DeleteResponse> listener, org.elasticsearch.client.http.Header... headers)
public org.elasticsearch.action.search.SearchResponse search(org.elasticsearch.action.search.SearchRequest searchRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void searchAsync(org.elasticsearch.action.search.SearchRequest searchRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.search.SearchResponse> listener, org.elasticsearch.client.http.Header... headers)
public org.elasticsearch.action.search.SearchResponse searchScroll(org.elasticsearch.action.search.SearchScrollRequest searchScrollRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void searchScrollAsync(org.elasticsearch.action.search.SearchScrollRequest searchScrollRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.search.SearchResponse> listener, org.elasticsearch.client.http.Header... headers)
public org.elasticsearch.action.search.ClearScrollResponse clearScroll(org.elasticsearch.action.search.ClearScrollRequest clearScrollRequest, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
public void clearScrollAsync(org.elasticsearch.action.search.ClearScrollRequest clearScrollRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.action.search.ClearScrollResponse> listener, org.elasticsearch.client.http.Header... headers)
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> Resp performRequestAndParseEntity(Req request, org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter, org.elasticsearch.common.CheckedFunction<org.elasticsearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, java.util.Set<java.lang.Integer> ignores, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> Resp performRequest(Req request, org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter, org.elasticsearch.common.CheckedFunction<org.elasticsearch.client.Response,Resp,java.io.IOException> responseConverter, java.util.Set<java.lang.Integer> ignores, org.elasticsearch.client.http.Header... headers) throws java.io.IOException
java.io.IOException
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> void performRequestAsyncAndParseEntity(Req request, org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter, org.elasticsearch.common.CheckedFunction<org.elasticsearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, org.elasticsearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores, org.elasticsearch.client.http.Header... headers)
protected <Req extends org.elasticsearch.action.ActionRequest,Resp> void performRequestAsync(Req request, org.elasticsearch.common.CheckedFunction<Req,org.elasticsearch.client.Request,java.io.IOException> requestConverter, org.elasticsearch.common.CheckedFunction<org.elasticsearch.client.Response,Resp,java.io.IOException> responseConverter, org.elasticsearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores, org.elasticsearch.client.http.Header... headers)