Giter Site home page Giter Site logo

imk13 / dropwizard-elasticsearch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dropwizard/dropwizard-elasticsearch

0.0 0.0 0.0 1.35 MB

A set of classes for using Elasticsearch in a Dropwizard service.

Home Page: http://dropwizard.github.io/dropwizard-elasticsearch/

License: Apache License 2.0

Shell 0.62% Java 99.38%

dropwizard-elasticsearch's Introduction

Dropwizard Elasticsearch

Build Status Coverage Status Maven Central

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

The package provides a lifecycle-managed client class (ManagedEsClient), a configuration class with the most common options (EsConfiguration), and some health checks 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:

  • nodeClient: When true, ManagedEsClient will create a NodeClient, otherwise a TransportClient; default: true
  • servers: A list of servers for usage with the created TransportClient if nodeClient is false
  • 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.

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>io.dropwizard.modules</groupId>
  <artifactId>dropwizard-elasticsearch</artifactId>
  <version>1.2.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.

dropwizard-elasticsearch's People

Contributors

akshay0709 avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar joschi avatar jplock avatar mattiasholmqvist avatar ricola77 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.