Skip to content

Commit

Permalink
Upgrade to 5.0.0 GA
Browse files Browse the repository at this point in the history
  • Loading branch information
masaruh committed Feb 15, 2017
1 parent 6f91305 commit 7627081
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 198 deletions.
121 changes: 45 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,10 @@ You need to install a version matching your Elasticsearch version:

| elasticsearch | Kuromoji Analysis Suggest Plugin |
|---------------|-----------------------------|
| es-1.4 | 0.9 |
| es-1.5 | 0.10.0 |
| es-1.6 | 0.11.0 |
| es-2.0.0 | 0.20.0 |
| es-2.0.1 | 0.20.1 |
| es-2.0.2 | 0.20.2 |
| es-2.1.0 | 0.21.0 |
| es-2.1.1 | 0.21.1 |
| es-2.1.2 | 0.21.2 |
| es-2.2.0 | 0.22.0 |
| es-2.2.1 | 0.22.1 |
| es-2.2.2 | 0.22.2 |
| es-5.0.0-rc1 | 5.0.0-rc1 |
| es-5.0.0 | 5.0.0 |


## Prerequisites
Expand All @@ -37,85 +28,54 @@ bin/plugin install https://github.com/masaruh/elasticsearch-japanese-suggester/r

## Exampl Usage

### Create index (0.21.1 or above)
```sh
curl -XPUT "http://localhost:9200/suggest_sample" -d'
### Create index (5.0.0 or above)
```
PUT suggest_sample
{
"mappings": {
"test": {
"properties": {
"suggest": {
"type": "japanese_completion",
"type": "completion",
"analyzer": "kuromoji_suggest_index",
"search_analyzer": "kuromoji_suggest_search",
"payloads": true
"search_analyzer": "kuromoji_suggest_search"
}
}
}
}
}'
}
```

### Create index (0.21.0 or below)

Use expand=true for indexing and expand=false for searching.
### Create index (0.22.2 or below)
```sh
curl -XPUT 'http://localhost:9200/suggest_sample/' -d'
curl -XPUT "http://localhost:9200/suggest_sample" -d'
{
"index": {
"analysis": {
"analyzer": {
"kuromoji_suggest_index":{
"tokenizer":"kuromoji_suggest_index"
},
"kuromoji_suggest_search":{
"tokenizer":"kuromoji_suggest_search"
}
},
"tokenizer":{
"kuromoji_suggest_index":{
"type": "kuromoji_suggest",
"expand":true
},
"kuromoji_suggest_search":{
"type": "kuromoji_suggest",
"expand":false
"mappings": {
"test": {
"properties": {
"suggest": {
"type": "japanese_completion",
"analyzer": "kuromoji_suggest_index",
"search_analyzer": "kuromoji_suggest_search",
"payloads": true
}
}
}
}
}
'
}'
```

Then add completion suggester configuration:
```sh
curl -XPUT 'http://localhost:9200/suggest_sample/test/_mapping' -d'
{
"properties": {
"suggest": {
"type": "japanese_completion",
"analyzer": "kuromoji_suggest_index",
"search_analyzer": "kuromoji_suggest_search",
"payloads": true
}
}
}
'
### Index a document
```

### Feed document
```sh
curl -XPUT 'http://localhost:9200/suggest_sample/test/1' -d'
PUT /suggest_sample/test/1
{
"suggest":"東京駅"
}
```

### Search
```sh
curl -XPOST 'http://localhost:9200/suggest_sample/_suggest' -d'
```
GET /suggest_sample/_suggest
{
"suggest" : {
"text" : "とうk",
Expand All @@ -127,22 +87,31 @@ curl -XPOST 'http://localhost:9200/suggest_sample/_suggest' -d'
'
{
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"suggest" : [ {
"text" : "とうk",
"offset" : 0,
"length" : 3,
"options" : [ {
"text" : "東京駅",
"score" : 1.0
} ]
} ]
"suggest": [
{
"text": "とうk",
"offset": 0,
"length": 3,
"options": [
{
"text": "東京駅",
"_index": "suggest_sample",
"_type": "test",
"_id": "1",
"_score": 1,
"_source": {
"suggest": "東京駅"
}
}
]
}
]
}
```


Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath "org.elasticsearch.gradle:build-tools:5.0.0-rc1"
classpath "org.elasticsearch.gradle:build-tools:5.0.0"
}
}

Expand All @@ -15,15 +15,15 @@ repositories {
}

group = 'org.elasticsearch.plugin'
version = '5.0.0-rc1-SNAPSHOT'
version = '5.0.0'

apply plugin: 'java'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'idea'

esplugin {
name 'elasticsearch-japanese-suggester'
description ''
description 'Suggester for Japanese'
classname 'org.elasticsearch.plugin.JapaneseSuggesterPlugin'
}

Expand Down
65 changes: 0 additions & 65 deletions examples/example.md

This file was deleted.

54 changes: 0 additions & 54 deletions examples/index.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public Map<String, AnalysisModule.AnalysisProvider<AnalyzerProvider<? extends An
return analyzers;
}

@Override
public Map<String, Suggester<?>> getSuggesters() {
return singletonMap("japanese_completion", JapaneseCompletionSuggester.INSTANCE);
}
Expand Down

0 comments on commit 7627081

Please sign in to comment.