Dropwizard Elasticsearch Bundle

Addon bundle for Dropwizard to support Elasticsearch

License

License

Categories

Categories

DropWizard Container Microservices Search Business Logic Libraries Elasticsearch
GroupId

GroupId

com.engagetech.dropwizard.modules
ArtifactId

ArtifactId

dropwizard-elasticsearch
Last Version

Last Version

1.2.8-ES6.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Dropwizard Elasticsearch Bundle
Addon bundle for Dropwizard to support Elasticsearch
Project URL

Project URL

https://github.com/dropwizard/dropwizard-elasticsearch
Source Code Management

Source Code Management

https://github.com/engagetech/dropwizard-elasticsearch

Download dropwizard-elasticsearch

How to add to project

<!-- https://jarcasting.com/artifacts/com.engagetech.dropwizard.modules/dropwizard-elasticsearch/ -->
<dependency>
    <groupId>com.engagetech.dropwizard.modules</groupId>
    <artifactId>dropwizard-elasticsearch</artifactId>
    <version>1.2.8-ES6.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.engagetech.dropwizard.modules/dropwizard-elasticsearch/
implementation 'com.engagetech.dropwizard.modules:dropwizard-elasticsearch:1.2.8-ES6.0.1'
// https://jarcasting.com/artifacts/com.engagetech.dropwizard.modules/dropwizard-elasticsearch/
implementation ("com.engagetech.dropwizard.modules:dropwizard-elasticsearch:1.2.8-ES6.0.1")
'com.engagetech.dropwizard.modules:dropwizard-elasticsearch:jar:1.2.8-ES6.0.1'
<dependency org="com.engagetech.dropwizard.modules" name="dropwizard-elasticsearch" rev="1.2.8-ES6.0.1">
  <artifact name="dropwizard-elasticsearch" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.engagetech.dropwizard.modules', module='dropwizard-elasticsearch', version='1.2.8-ES6.0.1')
)
libraryDependencies += "com.engagetech.dropwizard.modules" % "dropwizard-elasticsearch" % "1.2.8-ES6.0.1"
[com.engagetech.dropwizard.modules/dropwizard-elasticsearch "1.2.8-ES6.0.1"]

Dependencies

compile (5)

Group / Artifact Type Version
io.dropwizard : dropwizard-core jar
org.elasticsearch : elasticsearch jar 6.0.1
org.elasticsearch.client : elasticsearch-rest-high-level-client jar 6.0.1
org.elasticsearch.plugin : transport-netty4-client jar 6.0.1
org.apache.logging.log4j : log4j-to-slf4j jar 2.8.1

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-core jar 2.11.0

Project Modules

There are no modules declared in this project.

Dropwizard Elasticsearch

Forked from [mattflax/dropwizard-elasticsearch] 5

A set of classes for using [Elasticsearch] 1 (version 2.3.0 and higher) in a [Dropwizard] 2 application.

The package provides a [lifecycle-managed] 3 client class (ManagedEsClient), a configuration class with the most common options (EsConfiguration), and some [health checks] 4 which can instantly be used in any Dropwizard application.

Usage

Just add EsConfiguration to your Configuration class and create an ManagedEsClient instance in the run method of your service.

You can also add one of the existing health checks to your Environment in the same method. At least the usage of EsClusterHealthCheck is strongly advised.

public class DemoApplication extends Application<DemoConfiguration> {
    // [...]
    @Override
    public void run(DemoConfiguration config, Environment environment) {
        final ManagedEsClient managedClient = new ManagedEsClient(configuration.getEsConfiguration());
        environment.lifecycle().manage(managedClient);
        environment.healthChecks().register("ES cluster health", new EsClusterHealthCheck(managedClient.getClient()));
        // [...]
    }
}

Configuration

The following configuration settings are supported by EsConfiguration:

  • servers: A list of servers for usage with the created RestClient
  • clusterName: The name of the Elasticsearch cluster; default: "elasticsearch"
  • settings: Any additional settings for Elasticsearch, see Configuration
  • settingsFile: Any additional settings file for Elasticsearch, see Configuration

An example configuration file for creating a Node Client could like this:

clusterName: MyClusterName
settings:
  node.name: MyCustomNodeName

The order of precedence is: nodeClient/servers/clusterName > settings > settingsFile, meaning that any setting in settingsFile can be overwritten with settings which in turn get overwritten by the specific settings like clusterName.

Notes for Elasticsearch 6.x

Elasticsearch 6 uses RestClient instead of TransportClient. It does not allow the creation of a NodeClient, and it is removed in this version of the connector.

Maven Artifacts

This project is available on Maven Central. To add it to your project simply add the following dependencies to your pom.xml:

<dependency>
  <groupId>com.engagetech.dropwizard.modules</groupId>
  <artifactId>dropwizard-elasticsearch</artifactId>
  <version>1.2.8-ES6.0.1</version>
</dependency>

Support

Please file bug reports and feature requests in GitHub issues.

Acknowledgements

Thanks to Alexander Reelsen (@spinscale) for his Dropwizard Blog Sample which sparked the idea for this project.

License

Copyright (c) 2013-2017 Jochen Schalanda

This library is licensed under the Apache License, Version 2.0.

See http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.

com.engagetech.dropwizard.modules

Engage Technology Partners

Versions

Version
1.2.8-ES6.0.1
1.2.0-2-ES6.0.1-4
1.2.0-2-ES6.0.1-3
1.2.0-2-ES6.0.1-2
1.2.0-2-ES6.0.1
1.2.0-2-ES6.0.0