Skip to content

Java High Level REST Client plan for first release #23331

@javanna

Description

@javanna
Member

This is a meta issue to track work that's being done on the Java High Level REST Client.

See https://www.elastic.co/blog/state-of-the-official-elasticsearch-java-clients to know more about the state of the official Java clients and the plan moving forward.

The RestHighLevelClient will allow to reuse the same request objects (ActionRequest subclasses) and responses (ActionResponse subclasses) as the current transport client. The client object though will not be the same and the new one will not implement the current Client interface (see #9201 to know why).

The Java High Level REST Client label can be followed to track progress on the high level REST client, the following are the apis that we want to support for its first release:

Activity

falsyvalues

falsyvalues commented on Feb 28, 2017

@falsyvalues

I'm not sure if its correct place for that... Does HTTP Client will have native client features like custer sniffing and other cluster related features?

dadoonet

dadoonet commented on Feb 28, 2017

@dadoonet
Contributor

@falsyvalues ideally ask on discuss.elastic.co.
HTTP Client already has sniffing with https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/sniffer.html

Not related to the high level client.

moodysalem

moodysalem commented on Mar 6, 2017

@moodysalem

Could you make it a short term goal to pull out the model objects (e.g. SearchSourceBuilder, QueryBuilders) into their own maven module?

Right now the existing REST client, Jest, suggests adding the transport module as a dependency to use these request objects/builders, which in my case adds 20mb to my otherwise <10mb bundle-which is especially important because I'm using AWS lambda and a bigger bundle takes longer to get started.

Also, separating out these objects makes it easier to use your own HTTP client if you'd like to-IMO the request and response POJOs are much more useful than the client that abstracts making HTTP requests with those objects and deserialization/serialization, since there are already plenty of java HTTP clients and JSON serialization/deserialization libraries. Also in my case I need to configure the HTTP client to sign requests

EDIT: I am playing with separating out the model classes and it does seem like the model classes have a lot of dependencies on lucene and elasticsearch common classes which could make that a lot more difficult than I expected

2nd EDIT: I was able to get around bringing in the elasticsearch dependency building my query using JsonObjects and JsonArrays with a helper class

3rd EDIT: for anyone who runs into the same scenario as me.. here is the helper class that I used to build the query object https://gist.github.com/moodysalem/585033149bb85f1e6079f1d507f8c72d

javanna

javanna commented on Mar 14, 2017

@javanna
MemberAuthor

hi @moodysalem I agree that ideally the Java client should not depend on Elasticsearch. We would love not to have that but we gave high priority to have the high level REST client out there sooner rather than later, although it will still depend on Elasticsearch initially. Once it's out, we may decide to work on taking those requests and response classes out to a common library, but as you found out that will require quite some work, which is why we decided not to do it straight-away but rather go step by step.

s1monw

s1monw commented on Mar 15, 2017

@s1monw
Contributor

one thing that I can see being a low hanging fruit is that we can move out our core analyzers into a module. This would allow us to move out the analyzers-common JAR that is ~ 11MB which would help a lot with this issue already. I don't think breaking out SearchSourceBuilder is a low hanging fruit at all it has lots of dependencies, I also would rather want to make core smaller and keep on depending on it than doing it the other way round. There is also highlighters that can be moved in to a module or maybe even into the same module for simplicity. Suggesters is a similar thing.. I think we should look into this! @rjernst WDYT

nik9000

nik9000 commented on Mar 15, 2017

@nik9000
Member

I'd be happy to move the analyzers, suggesters, and highlighters into their own modules. I think it'd be faster to exclude their dependencies from the high level client, though a bit less clean.

s1monw

s1monw commented on Mar 15, 2017

@s1monw
Contributor

37 remaining items

yingqiaomxi

yingqiaomxi commented on Jul 24, 2017

@yingqiaomxi

Many thank!

dadoonet

dadoonet commented on Jul 28, 2017

@dadoonet
Contributor

Adding to the latest comments in case anyone is looking for the high level rest client that names changed and are now:

        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>5.6.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>5.6.0-SNAPSHOT</version>
        </dependency>
added a commit that references this issue on Aug 2, 2017
added a commit that references this issue on Aug 11, 2017
jagginarendra

jagginarendra commented on Sep 15, 2017

@jagginarendra

@dadoonet when I am using the below dependency, I am getting error in pom.xml

org.elasticsearch.client elasticsearch-rest-client 5.6.0-SNAPSHOT org.elasticsearch.client elasticsearch-rest-high-level-client 5.6.0-SNAPSHOT

error - Missing artifact org.elasticsearch.client:elasticsearch-rest-client:jar:5.6.0-SNAPSHOT

dadoonet

dadoonet commented on Sep 15, 2017

@dadoonet
Contributor

5.6.0 has been released. Remove the SNAPSHOT part

malhotras

malhotras commented on Jan 4, 2018

@malhotras

@dadoonet

Below is my pom.xml file..it is not working.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
     <groupId>tools.test</groupId>
  <artifactId>es-demo</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
   <name>es-demo</name>
   <repositories>
      <repository>
        <id>publicesrepo</id>
        <name>publicesrepo</name>
        <url>http://maven.elasticsearch.org/public-releases</url>
    </repository>
    </repositories>
  <dependencies>
   <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
</dependency>
 <dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>5.6.0</version>
  </dependency>
 <dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>5.6.0</version>
 </dependency>
<dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.5</version>
 </dependency>
</dependencies>

Error: Original error: Could not transfer artifact org.elasticsearch:elasticsearch:jar:5.6.0 from/to nexus (http://vm-maslxjavadev01.tools.org:8083/repository/maven-public/): unexpected end of stream

Can you please suggest the solution?

dadoonet

dadoonet commented on Jan 5, 2018

@dadoonet
Contributor

@malhotras Please ask your questions on discuss.elastic.co (with a good formatting please) where we can give a better support.

Thanks!

added a commit that references this issue on Feb 5, 2018
mrkk

mrkk commented on May 10, 2019

@mrkk

I'd be happy to move the analyzers, suggesters, and highlighters into their own modules. I think it'd be faster to exclude their dependencies from the high level client, though a bit less clean.

can you give an example of what is needed at bare minimum and what to exclude in a maven pom file for the REST client to work?

At the very least you guys can document this properly in examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @nik9000@dadoonet@brusic@mrkk@jprante

      Issue actions

        Java High Level REST Client plan for first release · Issue #23331 · elastic/elasticsearch