Class RestClientHttpClient
java.lang.Object
co.elastic.clients.transport.rest_client.RestClientHttpClient
- All Implemented Interfaces:
TransportHttpClient
-
Nested Class Summary
Nested classes/interfaces inherited from interface co.elastic.clients.transport.http.TransportHttpClient
TransportHttpClient.Node, TransportHttpClient.Request, TransportHttpClient.Response
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this client, freeing associated resources.createOptions
(TransportOptions options) Create a client-specific options value from an existing option object.performRequest
(String endpointId, TransportHttpClient.Node node, TransportHttpClient.Request request, TransportOptions options) Perform a blocking request.performRequestAsync
(String endpointId, TransportHttpClient.Node node, TransportHttpClient.Request request, TransportOptions options) Perform an asynchronous request.org.elasticsearch.client.RestClient
Returns the underlying low level Rest Client used by this transport.
-
Constructor Details
-
RestClientHttpClient
public RestClientHttpClient(org.elasticsearch.client.RestClient restClient)
-
-
Method Details
-
restClient
public org.elasticsearch.client.RestClient restClient()Returns the underlying low level Rest Client used by this transport. -
createOptions
Description copied from interface:TransportHttpClient
Create a client-specific options value from an existing option object. Ifnull
, this must create the default options to which additional options can be added.This method allows implementations to return subclasses with more features (that applications can use by downcasting the result). By default, it will use
DefaultTransportOptions
.- Specified by:
createOptions
in interfaceTransportHttpClient
-
performRequest
public TransportHttpClient.Response performRequest(String endpointId, @Nullable TransportHttpClient.Node node, TransportHttpClient.Request request, TransportOptions options) throws IOException Description copied from interface:TransportHttpClient
Perform a blocking request.- Specified by:
performRequest
in interfaceTransportHttpClient
- Parameters:
endpointId
- the endpoint identifier. Can be used to have specific strategies depending on the endpoint.node
- the node to send the request to. Ifnull
, the implementation has to choose which node to send the request to, or throw anIllegalArgumentException
.request
- the requestoptions
- additional options for the http client. Headers and request parameters set in the options have precedence over those defined by the request and should replace them in the final request sent.- Returns:
- the response
- Throws:
IOException
-
performRequestAsync
public CompletableFuture<TransportHttpClient.Response> performRequestAsync(String endpointId, @Nullable TransportHttpClient.Node node, TransportHttpClient.Request request, TransportOptions options) Description copied from interface:TransportHttpClient
Perform an asynchronous request.Implementations should return a
CompletableFuture
whose cancellation also cancels any http request in flight and frees the associated resources. This allows applications to implement scenarios like timeouts or "first to respond" fan-out without leaking resources.- Specified by:
performRequestAsync
in interfaceTransportHttpClient
- Parameters:
endpointId
- the endpoint identifier. Can be used to have specific strategies depending on the endpoint.node
- the node to send the request to. Ifnull
, the implementation has to choose which node to send the request to, or throw anIllegalArgumentException
.request
- the requestoptions
- additional options for the http client. Headers and request parameters set in the options have precedence over those defined by the request and should replace them in the final request sent.- Returns:
- a future that will be completed with the response.
-
close
Description copied from interface:TransportHttpClient
Close this client, freeing associated resources.- Specified by:
close
in interfaceTransportHttpClient
- Throws:
IOException
-