Skip to content

Commit c039a7a

Browse files
szabosteveswallez
authored andcommitted
[DOCS] Adds connecting section.
1 parent 1328fa8 commit c039a7a

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

docs/connecting.asciidoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[[connecting]]
2+
== Connecting
3+
4+
The code snippet below shows how to initialize a low level REST client and the
5+
Jackson object mapper to configure an ElasticsearchClient:
6+
7+
```
8+
// Create the low-level client
9+
RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200)).build();
10+
11+
// Create the transport that provides JSON and http services to API clients
12+
Transport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
13+
14+
// And create our API client
15+
ElasticsearchClient client = new ElasticsearchClient(transport);
16+
```
17+
18+
Authentication is managed by the
19+
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low.html[low-level Rest Client].
20+
For further details on configuring authentication, refer to the
21+
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/_basic_authentication.html[documentation].

docs/index.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]
55

66
include::introduction.asciidoc[]
7-
include::installation.asciidoc[]
7+
include::installation.asciidoc[]
8+
include::connecting.asciidoc[]

0 commit comments

Comments
 (0)