From 54c29af7b62d47b69962dc3036ac81503000d93a Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Fri, 15 Sep 2023 19:12:23 +0000 Subject: [PATCH] Fixing compile errors for ApacheHttpClient5Transport Signed-off-by: Vacha Shah --- USER_GUIDE.md | 10 +++++----- samples/build.gradle.kts | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/USER_GUIDE.md b/USER_GUIDE.md index adb4a140e5..c0d55b07ff 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -2,8 +2,8 @@ - [Setup](#setup) - [Basic Features](#basic-features) - [Creating a client](#creating-a-client) + - [Using `RestClientTransport`](#using-restclienttransport) - [Using `ApacheHttpClient5Transport`](#using-apachehttpclient5transport) - - [Using `RestClientTransport` (deprecated)](#using-restclienttransport-deprecated) - [Creating an index](#creating-an-index) - [With default settings](#with-default-settings) - [With custom settings and mappings](#with-custom-settings-and-mappings) @@ -46,7 +46,7 @@ You can find working versions of the code below that can be run with a local ins There are multiple low level transports which `OpenSearchClient` could be configured with. -#### Using `ApacheHttpClient5Transport` +#### Using `RestClientTransport` ```java import org.apache.http.HttpHost; @@ -72,9 +72,7 @@ Transport transport = new RestClientTransport(restClient, OpenSearchClient client = new OpenSearchClient(transport); ``` -See [SampleClient.java](./samples/src/main/java/org/opensearch/client/samples/SampleClient.java) for a working sample. - -#### Using `RestClientTransport` (deprecated) +#### Using `ApacheHttpClient5Transport` ```java import org.apache.hc.core5.http.HttpHost; @@ -99,6 +97,8 @@ The Apache HttpClient 5 based transport has dependences on Apache HttpClient 5 a Upcoming OpenSearch `3.0.0` release brings HTTP/2 support and as such, the `RestClientTransport` would switch to HTTP/2 if available (for both HTTPS and/or HTTP protocols). The desired protocol could be forced using `RestClientBuilder.HttpClientConfigCallback`. +See [SampleClient.java](./samples/src/main/java/org/opensearch/client/samples/SampleClient.java) for a working sample. + ### Creating an index #### With default settings diff --git a/samples/build.gradle.kts b/samples/build.gradle.kts index b8e7339202..8c635d83d9 100644 --- a/samples/build.gradle.kts +++ b/samples/build.gradle.kts @@ -28,6 +28,8 @@ dependencies { implementation("org.apache.logging.log4j", "log4j-slf4j2-impl","[2.17.1,3.0)") implementation("commons-logging", "commons-logging", "1.2") implementation("com.fasterxml.jackson.core", "jackson-databind", "2.15.2") + implementation("org.apache.httpcomponents.client5", "httpclient5", "5.2.1") + implementation("org.apache.httpcomponents.core5", "httpcore5", "5.2.2") } application {