- ElasticSearch: Low Level Rest Client Connection
- ElasticSearch: Low Level Client Put
- ElasticSearch: Low Level Client Get
In this tutorial I will show you how to use the ElasticSearch low level rest client.
First you will need to add the low level rest to the pom.
- <properties>
- <elasticSearch.version>6.2.4</elasticSearch.version>
- </properties>
- <dependency>
- <groupId>org.elasticsearch.client</groupId>
- <artifactId>elasticsearch-rest-client</artifactId>
- <version>${elasticSearch.version}</version>
- </dependency>
Next you will need to specify the imports.
- import org.apache.http.HttpHost;
- import org.elasticsearch.client.Response;
- import org.elasticsearch.client.RestClient;
- import org.elasticsearch.client.RestClientBuilder;
Now you can connect to ElasticSearch.
- final RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost("localhost", 9200, "http"));
- final RestClient restClient = builder.build();
Now you can do whatever you need to!
2 thoughts on “ElasticSearch: Low Level Rest Client Connection”
Comments are closed.