In the link it mentions below:
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.
Java High Level REST Client: the official high-level client for
Elasticsearch. Based on the low-level client, it exposes API specific
methods and takes care of requests marshalling and responses
un-marshalling.
Best way to understand more on this is to read the javadocs for which below are the links respectively
High Level Rest Client
makes use of Low Level Rest Client
which I believe, means, it extends classes and interfaces of Low Level Rest Client
.
Advantages of using High Level
over Low Level
are:
- Avoid developers to re-write code or in other words maintainability and readability of code.
- Helps developers understand and co-relate with ES's API usage like that of using Kibana
- If any of xpack features are to be used as well(graph or ml), High Level Client API has the client code available which could be used without hassle of rewriting everything using low level API.
Below sample examples can help I guess:
Example 1: Get a particular document
With High Level Rest Client:
GetRequest getRequest = new GetRequest("posts", "1");
With Low Level Rest Client:
Request request = new Request("GET", "/posts/1");
Example 2: Search API
With High Level Rest Client:
SearchRequest searchRequest = new SearchRequest("posts");
You can refer to this link
With Low Level Rest Client:
You would need to make use of Request
and Response
classes(low level) and using appropriate end-point
Request request = new Request("GET", "/posts/_search");
Example 3: Analyze text:
With High Level Rest Clent:
Make use of AnalyzeRequest class
With Low Level Rest Client:
Use again Request
and Response
class
Basically working on High Level Rest Client
is like working on Elasticsearch's API layer (which indirectly works via HTTP packages) while Low Level
is purely working on HTTP i.e. Request and Response models i.e. a higher abstraction.
Hope that helps!