Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

elasticsearch

Open Source, Distributed, RESTful Search Engine via Elastic Search.

exports

  • RestClient

dependency

<dependency>
  <groupId>org.jooby</groupId>
  <artifactId>jooby-elasticsearch</artifactId>
  <version>1.0.3</version>
</dependency>

usage

{
  use(new Elasticsearch("localhost:9200"));
}

The constructor field is an array, so you can specify several hosts for round robin of requests.

client API

The module exports a RestClient instance.

put("/:id", req -> {
  // index a document
  RestClient client = require(RestClient.class);
  StringEntity data = new StringEntity("{\"foo\":\"bar\"}");
  return client.performRequest("PUT", "/twitter/tweet/" + req.param("id").value(), Collections.emptyMap(), data)
    .getEntity().getContent();
});