• Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language
    Java
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Elasticsearch module for PlayFramework 2.x applications

play2-elasticsearch

===================

This module provides an easy Elasticsearch(v0.90.12) integration in a Playframework 2 application

Playframework Elasticsearch

Build Status

Versions

For Playframework version 2.0.x, see README-2.0.x.md

Module Playframework Elasticsearch Comments Diff
0.5.0 2.1-RC1 0.19.10 Compatibility with play 2.1-RC1
0.5.1 2.1-RC3 0.20.4 upgrade to ES 0.20.4 - works correctly with play 2.1-RC3
0.5.2 2.1.0 0.20.4 Upgrade to play 2.1.0 - includes scala helpers
0.5.3 2.1.0 0.20.5 Upgrade to ES 0.20.5 - moving artifact's organization from "com.github.cleverage - elasticsearch" to "com.clever-age - play2-elasticsearch"
0.5.4 2.1.0 0.20.5 API Async, Bulk, manage multi-index  v0.5.3 -> v0.5.4
0.5.5 2.1.0 0.20.5 Disabled plugin, use multiple index for an objet  v0.5.4 -> v0.5.5
0.5-SNAPSHOT 2.1.1 0.90.0 Upgrade to ES 0.90.0
0.6-SNAPSHOT 2.1.1 0.90.2 Upgrade to ES 0.90.2
0.7-SNAPSHOT 2.1.3 0.90.3 Upgrade to ES 0.90.3 & play 2.1.3
0.8-SNAPSHOT 2.2.1 0.90.12 Upgrade to ES 0.90.12 & play 2.2.1
0.8.1 2.2.1 0.90.12 Upgrade to ES 0.90.12 & play 2.2.1
0.8.2 2.2.1 0.90.12 Small fixes
1.1.0 2.2.1 1.1.0 Upgrading the ES 1.1.0 (#47)
1.4-SNAPSHOT 2.2.1 1.4.1 Upgrading the ES 1.4.1 (#59)
2.1-SNAPSHOT 2.4.6 2.1.1 Upgrading the ES 2.1.1

Install

The dependency declaration is :

"com.clever-age" % "play2-elasticsearch" % "2.1-SNAPSHOT"

Since v0.8.1, releases are published on maven-central, so you don't have to define any specific resolvers.

If you want to use a snapshot version, you will have to register the Sonatype OSS snapshot repository :

resolvers +=   "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

Your build.sbt should look like :


name := "test-play2-elasticsearch"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  "com.clever-age"          % "play2-elasticsearch"       % "2.1-SNAPSHOT"
)

play.Project.playScalaSettings

// Uncomment this line if you use a snapshot version
// resolvers +=   "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

Activate the Plugin/Module

Plugins were prior to 2.1-SNAPSHOT:

The Play2-elasticsearch module requires its plugin class to be declared in the conf/play.plugins file. If this file doesn't exist (it's not created by default when you create a new project), just create it in the conf directory first, and then add

9000:com.github.cleverage.elasticsearch.plugin.IndexPlugin

Modules were introduced in the 2.1-SNAPSHOT:

The Play2-elasticsearch module requires a Module class to be enabled inside of conf/application.conf

play.modules.enabled += "com.github.cleverage.elasticsearch.module.IndexModule"

Configuration

You can configure the module in conf/application.conf (or in any configuration file included in your application.conf)

## ElasticSearch Configuration
##############################
## define local mode or not
elasticsearch.local=false

## Coma-separated list of clients
elasticsearch.client="192.168.0.46:9300"
# ex : elasticsearch.client="192.168.0.46:9300,192.168.0.47:9300"

## Name of the index
elasticsearch.index.name="play2-elasticsearch"

## Custom settings to apply when creating the index (optional)
elasticsearch.index.settings="{ analysis: { analyzer: { my_analyzer: { type: \"custom\", tokenizer: \"standard\" } } } }"

## define package or class separate by commas for loading @IndexType and @IndexMapping information
elasticsearch.index.clazzs="indexing.*"

## show request & result json of search request in log (it will be logged using Logger.debug())
elasticsearch.index.show_request=true

Usage

HelloWorld

Create a Class extending "com.github.cleverage.elasticsearch.Index"

Example : IndexTest.java

IndexTest indexTest = new IndexTest();
indexTest.name = "hello World";
indexTest.index();

IndexTest byId = IndexTest.find.byId("1");

IndexResults<IndexTest> all = IndexTest.find.all();

IndexQuery<IndexTest> indexQuery = IndexTest.find.query();
indexQuery.setBuilder(QueryBuilders.queryString("hello"));
IndexResults<IndexTest> results = IndexTest.find.search(indexQuery);

More Complex

Example : https://github.com/cleverage/play2-elasticsearch/blob/master/samples/elasticsearch-java/app/indexing/Team.java

See samples/elasticsearch-java application for more sample

Scala

Starting from version 0.5.2, Scala helpers are available (see module com.github.cleverage.elasticsearch.ScalaHelpers).

See samples/elasticsearch-scala application for a basic example

Authors

http://twitter.com/nboire & http://twitter.com/mguillermin

License

This code is released under the MIT License

More Repositories

1

daltons

a command-line tool that computes optimal image widths to put in srcset attributes of responsive images
JavaScript
39
star
2

eav-manager

Blazing fast data modeling and enrichment
JavaScript
22
star
3

Ruler

PHP
22
star
4

process-bundle

This bundle allows to configure series of tasks to be performed on a certain order. Basically, it will greatly ease the configuration of import and exports but can do much more.
PHP
20
star
5

garden-starter-kit

La base de projet utilisé pour le développement static front-end chez Clever Garden
JavaScript
20
star
6

ColissimoBundle

PHP
7
star
7

responsive-video-background

A Web Component that helps responsively using a video as the background of a content block
HTML
7
star
8

CleverAgeSyliusColissimoPlugin

PHP
5
star
9

symfonyEclipseTools

Some tools for integrating symfony into Eclipse
Java
5
star
10

LifestreamBundle

LifestreamBundle is a collection of services for Symfony2 providing easy Lifestream generation, social data fetching, stats, and more. Nothing is working at the moment :/
PHP
5
star
11

streamed-zip-archive

A PHP Composer package to create a ZIP in memory, using an external binary
PHP
4
star
12

accessibility-steps

Traduction des Accessibility Steps de Opquast
3
star
13

dashboard-a11y

Accessibility dashboard
JavaScript
3
star
14

akeneo-geoloc-attribute

PHP
3
star
15

m2-tools

PHP
3
star
16

decks-template

A node (grunt) project for markdown-based presentation using reveal.js — vNext : switching from JavaScript inclusion of Markdown to Jekyll building of decks.
CSS
3
star
17

process-bundle-ui-demo

PHP
2
star
18

php-orchestrator

PHP
2
star
19

dockerfiles

Clever Age's Dockerfiles
Shell
2
star
20

formation-git

Repository pour la formation Institut sur l'utilisation de Git
Shell
2
star
21

eslint-config

eslint config for Clever Age projects
JavaScript
2
star
22

permission-bundle

Simple permission management based on PHP classes and roles
PHP
2
star
23

gsk-cli

Utilitaire en ligne de commande pour installer le Garden Starter Kit
JavaScript
2
star
24

php-trac

PHP
2
star
25

formation-Symfony2

1
star
26

kss-builder

Builder for KSS
1
star
27

useragent-conference-parisweb2012

Conférence "Les User Agents, c'est le mal !" donnée par Rudy Rigot pour Paris Web 2012, basée sur impress.js
CSS
1
star
28

ca.jquery.sticky

Public repository for the jQuery Plugin "Sticky"
HTML
1
star
29

CleverAgeSyliusDpdPlugin

PHP
1
star
30

layout-bundle

Simple layout management in Symfony
PHP
1
star
31

oauth-api-bundle

Dedicated AdminBundle previously found in the EAVManager stripped from everything not directly related to managing basic Doctrine entities
PHP
1
star
32

eav-manager-starter-kit

Starter Kit for the Clever Data Manager
PHP
1
star
33

LifestreamBundleSandbox

A sandbox for newbies willing to test the LifestreamBundle
PHP
1
star
34

ca.jquery.simplemodal

JavaScript
1
star
35

ca.jquery.equalized

Public repository for the jQuery Plugin "Equalized"
JavaScript
1
star
36

twigjs-drupal-render-array

JavaScript
1
star
37

EzplatformSettingsBundle

SCSS
1
star
38

Robotlegs-Twitter-Demo

ActionScript
1
star
39

demo-elasticsearch

Retrouvez dans le dossier php/symfony1 les sources de l'application présentée sur notre blog dans le billet "Améliorer les performances des applications web avec Elasticsearch"
PHP
1
star