Maven client dependencies on elasticsearch

I have a webapp that uses Elasticsearch. I use the standalone Elasticsearch server and the transport client for communication from the web client side.

Currently I am including the dependency org.elasticsearch:elasticsearch:jar:1.3.4 in my pom.xml and everything is working fine. The fact is that this dependence, together with transit, is summed up to 20 MB, which is ridiculous. I just want to use the transport client.

Is there an easier client dependency? Will there ever be one? (I do not want to use jest or httpclient with the REST API).

+6
source share
1 answer

You may be looking for Elasticsearch Thrift. The lean transport platform allows you to use the REST interface over a transaction over HTTP.

This is a lightweight client that has a size of about ~ 100 kb, and you also need the apache trift jar library, which is about ~ 3.4mb:

You can add them to your Maven dependencies:

For Elasticsearch-Thrift

 <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch-transport-thrift</artifactId> <version>2.4.0</version> </dependency> 

and for Apache-Thrift dependencies:

 <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>0.9.0</version> </dependency> 

I hope you can find which version you need to use, depending on your version of the elasticsearch cluster.

For more information on elicsearch-trift, check out the github project page .

And check the apache trift official page for Thrift.

Edit: Please keep in mind that according to the github project page, Thrift Transport is deprecated as Elasticsearch v1.5.0 and will be removed in version 2.0.

0
source

Source: https://habr.com/ru/post/977816/


All Articles