Skip to content

Commit

Permalink
Fixing compile errors for ApacheHttpClient5Transport
Browse files Browse the repository at this point in the history
Signed-off-by: Vacha Shah <vachshah@amazon.com>
  • Loading branch information
VachaShah committed Sep 15, 2023
1 parent 9858c41 commit 54c29af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions samples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 54c29af

Please sign in to comment.