Class AwsSdk2Transport
java.lang.Object
org.opensearch.client.transport.aws.AwsSdk2Transport
- All Implemented Interfaces:
Closeable,AutoCloseable,OpenSearchTransport,Transport
Implementation of the OpenSearchTransport interface that sends signed requests using
the AWS v2 SDK HTTP clients, to connect to an AWS OpenSearch service using IAM authentication.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IntegerBy default, requests that exceed this size will be automatically compressed. -
Constructor Summary
ConstructorsConstructorDescriptionAwsSdk2Transport(software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, String host, String signingServiceName, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options) Create anOpenSearchTransportwith an asynchronous AWS HTTP client.AwsSdk2Transport(software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, String host, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options) Create anOpenSearchTransportwith an asynchronous AWS HTTP client.AwsSdk2Transport(software.amazon.awssdk.http.SdkHttpClient syncHttpClient, String host, String signingServiceName, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options) Create anOpenSearchTransportwith a synchronous AWS HTTP client.AwsSdk2Transport(software.amazon.awssdk.http.SdkHttpClient syncHttpClient, String host, software.amazon.awssdk.regions.Region signingRegion, AwsSdk2TransportOptions options) Create anOpenSearchTransportwith a synchronous AWS HTTP client. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()options()Default options used by this transport if none are provided inTransport.performRequest(Object, Endpoint, TransportOptions)orTransport.performRequestAsync(Object, Endpoint, TransportOptions);<RequestT,ResponseT, ErrorT>
ResponseTperformRequest(RequestT request, Endpoint<RequestT, ResponseT, ErrorT> endpoint, TransportOptions options) <RequestT,ResponseT, ErrorT>
CompletableFuture<ResponseT> performRequestAsync(RequestT request, Endpoint<RequestT, ResponseT, ErrorT> endpoint, TransportOptions options)
-
Field Details
-
DEFAULT_REQUEST_COMPRESSION_SIZE
By default, requests that exceed this size will be automatically compressed.AwsSdk2TransportOptionscan be used to override this setting or disable compression.
-
-
Constructor Details
-
AwsSdk2Transport
public AwsSdk2Transport(@CheckForNull software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, @Nonnull String host, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options) Create anOpenSearchTransportwith an asynchronous AWS HTTP client.Note that asynchronous OpenSearch requests sent through this transport will be dispatched *synchronously* on the calling thread.
- Parameters:
asyncHttpClient- Asynchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.options- Options that apply to all requests. Can be null. Create withAwsSdk2TransportOptions.builder()and use these to specify non-default credentials, compression options, etc.
-
AwsSdk2Transport
public AwsSdk2Transport(@CheckForNull software.amazon.awssdk.http.SdkHttpClient syncHttpClient, @Nonnull String host, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options) Create anOpenSearchTransportwith a synchronous AWS HTTP client.- Parameters:
syncHttpClient- Synchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.options- Options that apply to all requests. Can be null. Create withAwsSdk2TransportOptions.builder()and use these to specify non-default credentials, compression options, etc.- Implementation Note:
- Using
software.amazon.awssdk.http.apache.ApacheHttpClientis discouraged as it does not support request bodies on GET or DELETE requests. This leads to incorrect handling of requests such asOpenSearchClientBase.clearScroll(org.opensearch.client.opensearch.core.ClearScrollRequest)andOpenSearchClientBase.deletePit(org.opensearch.client.opensearch.core.pit.DeletePitRequest). As suchperformRequest(Object, Endpoint, TransportOptions)&performRequestAsync(Object, Endpoint, TransportOptions)will throw aTransportExceptionif an unsupported request is encountered while usingApacheHttpClient.
-
AwsSdk2Transport
public AwsSdk2Transport(@CheckForNull software.amazon.awssdk.http.async.SdkAsyncHttpClient asyncHttpClient, @Nonnull String host, @Nonnull String signingServiceName, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options) Create anOpenSearchTransportwith an asynchronous AWS HTTP client.Note that asynchronous OpenSearch requests sent through this transport will be dispatched *synchronously* on the calling thread.
- Parameters:
asyncHttpClient- Asynchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingServiceName- The AWS signing service name, one of `es` (Amazon OpenSearch) or `aoss` (Amazon OpenSearch Serverless).signingRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.options- Options that apply to all requests. Can be null. Create withAwsSdk2TransportOptions.builder()and use these to specify non-default credentials, compression options, etc.
-
AwsSdk2Transport
public AwsSdk2Transport(@CheckForNull software.amazon.awssdk.http.SdkHttpClient syncHttpClient, @Nonnull String host, @Nonnull String signingServiceName, @Nonnull software.amazon.awssdk.regions.Region signingRegion, @CheckForNull AwsSdk2TransportOptions options) Create anOpenSearchTransportwith a synchronous AWS HTTP client.- Parameters:
syncHttpClient- Synchronous HTTP client to use for OpenSearch requests.host- The fully qualified domain name to connect to.signingServiceName- The AWS signing service name, one of `es` (Amazon OpenSearch) or `aoss` (Amazon OpenSearch Serverless).signingRegion- The AWS region for which requests will be signed. This should typically match the region in `host`.options- Options that apply to all requests. Can be null. Create withAwsSdk2TransportOptions.builder()and use these to specify non-default credentials, compression options, etc.- Implementation Note:
- Using
software.amazon.awssdk.http.apache.ApacheHttpClientis discouraged as it does not support request bodies on GET or DELETE requests. This leads to incorrect handling of requests such asOpenSearchClientBase.clearScroll(org.opensearch.client.opensearch.core.ClearScrollRequest)andOpenSearchClientBase.deletePit(org.opensearch.client.opensearch.core.pit.DeletePitRequest). As suchperformRequest(Object, Endpoint, TransportOptions)&performRequestAsync(Object, Endpoint, TransportOptions)will throw aTransportExceptionif an unsupported request is encountered while usingApacheHttpClient.
-
-
Method Details
-
performRequest
public <RequestT,ResponseT, ResponseT performRequestErrorT> (RequestT request, Endpoint<RequestT, ResponseT, throws IOExceptionErrorT> endpoint, @Nullable TransportOptions options) - Specified by:
performRequestin interfaceTransport- Throws:
IOException
-
performRequestAsync
public <RequestT,ResponseT, CompletableFuture<ResponseT> performRequestAsyncErrorT> (RequestT request, Endpoint<RequestT, ResponseT, ErrorT> endpoint, @Nullable TransportOptions options) - Specified by:
performRequestAsyncin interfaceTransport
-
jsonpMapper
- Specified by:
jsonpMapperin interfaceTransport
-
options
Description copied from interface:TransportDefault options used by this transport if none are provided inTransport.performRequest(Object, Endpoint, TransportOptions)orTransport.performRequestAsync(Object, Endpoint, TransportOptions); -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-