<commit_before># play2-elasticsearch
===================

This module provides [Elasticsearch](http://www.elasticsearch.org/)(v0.19.10) in a play2 application

## Versions
 * 0.1 -> init version
 * 0.2 -> Percolators support
 * 0.3 -> IndexResult : add pagination data
 * 0.4 -> upgrade ES to 0.19.10
 * 0.4.1 -> allow advanced query ( with hightlight, .... ) 
 * 0.4.2 -> upgrade play2.0.4 + allow index settings in conf 

## Roadmap
 0.5 -> Add binding for Ebean Model via an IndexModel.class

## Installing

The dependency declaration is
```
"com.github.cleverage" % "elasticsearch_2.9.1" % "0.4.2"
```
The resolver repository is 

```
 resolvers += Resolver.url("GitHub Play2-elasticsearch Repository", url("http://cleverage.github.com/play2-elasticsearch/releases/"))(Resolver.ivyStylePatterns)
```

So the Build.scala looks like 
```
import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = "elasticsearch-sample"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      // Add your project dependencies here,
      "com.github.cleverage" % "elasticsearch_2.9.1" % "0.4.2"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
      // Add your own project settings here      
      resolvers += Resolver.url("GitHub Play2-elasticsearch Repository", url("http://cleverage.github.com/play2-elasticsearch/releases/"))(Resolver.ivyStylePatterns)
    )

}
```


## Activate the plugin

Play2-elasticsearch requires its plugin 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
```

## Configuration
Add settings in conf/application.conf

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

## list 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<commit_msg>Informations for 0.5.0 in the README file<commit_after># play2-elasticsearch
===================

This module provides [Elasticsearch](http://www.elasticsearch.org/)(v0.19.10) in a play2 application

## Versions
 * 0.1 -> init version
 * 0.2 -> Percolators support
 * 0.3 -> IndexResult : add pagination data
 * 0.4 -> upgrade ES to 0.19.10
 * 0.4.1 -> allow advanced query ( with hightlight, .... ) 
 * 0.4.2 -> upgrade play2.0.4 + allow index settings in conf 

 * 0.5.0 -> compatibility with play 2.1-RC1

## Installing

The dependency declaration is
```
"com.github.cleverage" % "elasticsearch_2.9.1" % "0.4.2"
```
or 
```
"com.github.cleverage" %% "elasticsearch" % "0.5.0"
```

The resolver repository is 

```
 resolvers += Resolver.url("GitHub Play2-elasticsearch Repository", url("http://cleverage.github.com/play2-elasticsearch/releases/"))(Resolver.ivyStylePatterns)
```

So the Build.scala looks like 
```
import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = "elasticsearch-sample"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      // Add your project dependencies here,
      "com.github.cleverage" % "elasticsearch_2.9.1" % "0.4.2"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
      // Add your own project settings here      
      resolvers += Resolver.url("GitHub Play2-elasticsearch Repository", url("http://cleverage.github.com/play2-elasticsearch/releases/"))(Resolver.ivyStylePatterns)
    )

}
```

or for play 2.1-RC1 : 
```
import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

    val appName         = "elasticsearch-sample"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      // Add your project dependencies here,
      "com.github.cleverage" %% "elasticsearch" % "0.5.0"
    )

    val main = play.Project(appName, appVersion, appDependencies).settings(
      // Add your own project settings here      
      resolvers += Resolver.url("GitHub Play2-elasticsearch Repository", url("http://cleverage.github.com/play2-elasticsearch/releases/"))(Resolver.ivyStylePatterns)
    )

}
```

## Activate the plugin

Play2-elasticsearch requires its plugin 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
```

## Configuration
Add settings in conf/application.conf

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

## list 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
{'fraction_non_alphanumeric': 0.14371138130356786, 'fraction_numerical': 0.04106039465816225, 'mean_word_length': 3.707317073170732, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7400100', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1550, 'n_words': 415}