Skip to content

obourgain/elasticsearch-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elasticsearch-http

Build Status

An elasticsearch client library similar to the transport client but using HTTP. The inputs of the client are similar to the transport client, so you can reuse your builders. The object returned are different and based on the returned JSON.

This is not fully production-ready nor production proof, some features are missing.

If you use it, even just to test, I would love to hear your feedback and do not hesitate to open issues or contribute.

The current version uses RxNetty under the hood, but that may change. An API using Rx is planned but not yet developed, the current API exposes sync and async variant of each method like the transport client.

Compatibility

Elasticsearch version
1.4.x
1.5.x
1.6.x
1.7.x

Building

Clone the repository and run mvn package to build it and run tests or mvn install to make it available in your local maven repository.

Add it to your project

Using Maven :

<dependency>
    <groupId>com.github.obourgain</groupId>
    <artifactId>elasticsearch-http-client</artifactId>
    <version>0.1</version>
</dependency>

Features :

  • search with queries/filters
  • aggregations
  • document APIs (get, insert, update, delete ...)
  • bulks
  • multiget
  • delete by query
  • termvectors & multi termvectors
  • scroll
  • explain
  • percolate & multipercolate
  • indices admin

Not supported

These features are either not implemented or too work-in-progress to be used with the http client

  • suggests : still work to do
  • facets : (already deprecated)
  • cluster admin apis : work in progress
  • search shard
  • search template
  • _analyze : not implemented
  • probably a lot of other stuff

### Getting started

Get the URL of at least one Elasticsearch node, with the http port, and not the transport port. By default the port is in the range 9200-9299.

Create an instance of HttpClient and give it the URLs of your nodes.

HttpClient client = new HttpClient("localhost:9200");
SearchRequest searchRequest = new SearchRequest("the_index").types("the_type").source(new SearchSourceBuilder().query(matchAllQuery()));
SearchResponse searchResponse = httpClient.search(searchRequest).get();
Hits hits = searchResponse.getHits();

Remember to close() when you are done.

About

Elasticsearch client using the HTTP API in Java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages