Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java HTTP Client for ElasticSearch

Tags:

I'm trying to connect from Java to ElasticSearch but I can only connect over HTTP. I can't use the TransportClient. Is there a Java client wrapper around the ElasticSearch REST APIs? If so, how do I use it?

like image 840
James Ward Avatar asked May 04 '12 01:05

James Ward


People also ask

How do I connect to Elasticsearch in Java?

use the high level rest client: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.3/java-rest-high.html. Also, note that the rest port is 9200, for when using the java high level rest client. i added some jar file and copy the given code but it says cannot find symbol HttpHost .

How do I connect to Elasticsearch client?

There are two ways to connect to your Elasticsearch cluster: Through the RESTful API or through the Java transport client. Both ways use an endpoint URL that includes a port, such as https://ec47fc4d2c53414e1307e85726d4b9bb.us-east-1.aws.found.io:9243 .

What is Resthighlevelclient?

Java Low Level REST Client: the official low-level client for Elasticsearch. It allows to communicate with an Elasticsearch cluster through http. Leaves requests marshalling and responses un-marshalling to users. It is compatible with all Elasticsearch versions.

What is REST client in Java?

The RestClient is used to create instances of Resource classes that are used to make the actual invocations to the service. The client can be initialized with a user supplied configuration to specify custom Provider classes, in addition to other configuration options.


2 Answers

Hi There is a brand new project just matching your needs. It Java based Rest API for Elasticsearch

Check it out! its name JEST

like image 197
dogukan sonmez Avatar answered Oct 10 '22 11:10

dogukan sonmez


A new "official" REST-based java client will be available starting with v5.0.0-alpha4.

like image 40
imotov Avatar answered Oct 10 '22 11:10

imotov