Skip to content

pulkitsinghal/elasticsearch-jetty

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jetty Plugin

Compatibility

The following table shows the versions of elasticsearch and jetty that Jetty Plugin was built with.

Jetty Plugin Elasticsearch Jetty
master 0.19.2.RC2 7.4.5.v20110725
0.18.1-0.18.6 0.18.5 7.4.5.v20110725
0.18.0 0.18.4 7.4.5.v20110725

Overview

Jetty plugin consists of two modules that can be used independently: JettyHttpServerTransport and FilterHttpTransportModule.

JettyHttpServerTransportModule can be used as a replacement for NettyHttpServerTransport. It embeds a fully functional and configurable Jetty 7.4.5 server and includes two jetty handlers that simplify configuration and usage of jetty with elasticsearch: JettyHttpServerTransportHandler and RestConstraintSecurityHandler.

JettyHttpServerTransportHandler is Jetty handler that redirects all requests to elasticsearch. It can be used in conjunction with RestConstraintSecurityHandler. RestConstraintSecurityHandler is based on and quite similar to standard jetty ConstraintSecurityHandler. However, its handling of pathSpecs in constraints is better suited for elasticsearch. ConstraintSecurityHandler can only handle wildcards at the end of the url or if file extension is specified, which makes it unsuitable any indexing operation constraints. RestConstraintSecurityHandler is treating pathSpec the same way as ElasticSearch does and can use ElasticSearch url mapping syntax to specify constraint paths.

FilterHttpTransportModule intercepts all requests that HttpServerTransport sends to elasticsearch. It can maintained a chain of filters and can be used with jetty as well as netty transports. By default, FilterHttpTransportModule is configured to work with jetty. This plugin comes with two sample filters: LoggingFitlerHttpServerAdapter and TimeoutFilterHttpServerAdapter.

Installation and Configuration

Jetty plugin can be installed as any other ES plugin using bin/plugin utility:

bin/plugin -install sonian/elasticsearch-jetty/0.18.6

After Jetty plugin is installed, it has to be enabled in elasticsearch.yml file by adding the following line:

http.type: com.sonian.elasticsearch.http.jetty.JettyHttpServerTransportModule

The embedded jetty is configured using standard jetty.xml file. By default, this file has to be located in the ES config directory. An alternative location can be specified using the sonian.elasticsearch.http.jetty.config setting. In order to function properly, the Jetty configuration has to create JettyHttpServerTransportHandler and add at least one internet connector. See jetty-minimal.xml for a minimal functional configuration. ElasticSearch is using the first available internet connector to determine bind and publish addresses of the http transport.

To get started, download jetty-minimal.xml file into config directory of elasticsearch home and rename it to jetty.xml. Now elasticsearch can be started.

curl https://raw.github.com/sonian/elasticsearch-jetty/master/config/jetty-minimal.xml -o config/jetty.xml

Advanced Configuration

A more advanced configuration can be found in the config/elasticsearch.yml file. It meant to be used with the following jetty configuration file config/jetty.xml.

The sample configuraiton file shows how to enable request logging filter. By default, this filter is logging all rest requests at the INFO level into the same logging file as all other ElasticSearch messages. It’s possible to redirect request logging into a separate file. See config/logging.yml for more details.

Jetty plugin exposes several ES settings as Jetty properties that can be used in Jetty configuration files using <Property name="property.name"/>

  • es.home – ElasticSearch home directory
  • es.config – ElasticSearch configuration directory
  • es.data – ElasticSearch data directory
  • es.cluster.data – ElasticSearch data directory for the cluster
  • es.cluster – Cluster name
  • jetty.bing_host – Http bind host, if the setting sonian.elasticsearch.http.jetty.bind_host is not specified, ElasticSearch will try to use values specified in http.bind_host and http.host settings.
  • jetty.port – Http port, if the setting sonian.elasticsearch.http.jetty.port is not specified, ElasticSearch will try to use http.port or default to 9200-9300. If port is specified in form of the range, ElasticSearch will try to start Jetty with each individual port number iterating through the range.
  • jetty.* – all other settings specified in sonian.elasticsearch.http.jetty. are exposed as Jetty properties. For example, the setting sonian.elasticsearch.http.jetty.foo can be referred to in Jetty configuration as .

User group

Join elasticsearch-jetty group for questions and discussions related to this plugin.

Automation alternatives

Here’s a list of currently known links that attempt to automate the process of installing ES & the elasticsearch-jetty plugin:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.3%
  • Shell 0.7%