Skip to content

Commit 2bac83d

Browse files
authored
Merge pull request #46 from masaruh/upgrade_5
Upgrade to 5.0.0 GA
2 parents 6f91305 + 7627081 commit 2bac83d

File tree

5 files changed

+49
-198
lines changed

5 files changed

+49
-198
lines changed

README.md

Lines changed: 45 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,10 @@ You need to install a version matching your Elasticsearch version:
99

1010
| elasticsearch | Kuromoji Analysis Suggest Plugin |
1111
|---------------|-----------------------------|
12-
| es-1.4 | 0.9 |
13-
| es-1.5 | 0.10.0 |
14-
| es-1.6 | 0.11.0 |
15-
| es-2.0.0 | 0.20.0 |
16-
| es-2.0.1 | 0.20.1 |
17-
| es-2.0.2 | 0.20.2 |
18-
| es-2.1.0 | 0.21.0 |
19-
| es-2.1.1 | 0.21.1 |
20-
| es-2.1.2 | 0.21.2 |
2112
| es-2.2.0 | 0.22.0 |
2213
| es-2.2.1 | 0.22.1 |
2314
| es-2.2.2 | 0.22.2 |
24-
| es-5.0.0-rc1 | 5.0.0-rc1 |
15+
| es-5.0.0 | 5.0.0 |
2516

2617

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

3829
## Exampl Usage
3930

40-
### Create index (0.21.1 or above)
41-
```sh
42-
curl -XPUT "http://localhost:9200/suggest_sample" -d'
31+
### Create index (5.0.0 or above)
32+
```
33+
PUT suggest_sample
4334
{
4435
"mappings": {
4536
"test": {
4637
"properties": {
4738
"suggest": {
48-
"type": "japanese_completion",
39+
"type": "completion",
4940
"analyzer": "kuromoji_suggest_index",
50-
"search_analyzer": "kuromoji_suggest_search",
51-
"payloads": true
41+
"search_analyzer": "kuromoji_suggest_search"
5242
}
5343
}
5444
}
5545
}
56-
}'
46+
}
5747
```
5848

59-
### Create index (0.21.0 or below)
60-
61-
Use expand=true for indexing and expand=false for searching.
49+
### Create index (0.22.2 or below)
6250
```sh
63-
curl -XPUT 'http://localhost:9200/suggest_sample/' -d'
51+
curl -XPUT "http://localhost:9200/suggest_sample" -d'
6452
{
65-
"index": {
66-
"analysis": {
67-
"analyzer": {
68-
"kuromoji_suggest_index":{
69-
"tokenizer":"kuromoji_suggest_index"
70-
},
71-
"kuromoji_suggest_search":{
72-
"tokenizer":"kuromoji_suggest_search"
73-
}
74-
},
75-
76-
"tokenizer":{
77-
"kuromoji_suggest_index":{
78-
"type": "kuromoji_suggest",
79-
"expand":true
80-
},
81-
"kuromoji_suggest_search":{
82-
"type": "kuromoji_suggest",
83-
"expand":false
53+
"mappings": {
54+
"test": {
55+
"properties": {
56+
"suggest": {
57+
"type": "japanese_completion",
58+
"analyzer": "kuromoji_suggest_index",
59+
"search_analyzer": "kuromoji_suggest_search",
60+
"payloads": true
8461
}
8562
}
8663
}
8764
}
88-
}
89-
'
65+
}'
9066
```
9167

92-
Then add completion suggester configuration:
93-
```sh
94-
curl -XPUT 'http://localhost:9200/suggest_sample/test/_mapping' -d'
95-
{
96-
"properties": {
97-
"suggest": {
98-
"type": "japanese_completion",
99-
"analyzer": "kuromoji_suggest_index",
100-
"search_analyzer": "kuromoji_suggest_search",
101-
"payloads": true
102-
}
103-
}
104-
}
105-
'
68+
### Index a document
10669
```
107-
108-
### Feed document
109-
```sh
110-
curl -XPUT 'http://localhost:9200/suggest_sample/test/1' -d'
70+
PUT /suggest_sample/test/1
11171
{
11272
"suggest":"東京駅"
11373
}
11474
```
11575

11676
### Search
117-
```sh
118-
curl -XPOST 'http://localhost:9200/suggest_sample/_suggest' -d'
77+
```
78+
GET /suggest_sample/_suggest
11979
{
12080
"suggest" : {
12181
"text" : "とうk",
@@ -127,22 +87,31 @@ curl -XPOST 'http://localhost:9200/suggest_sample/_suggest' -d'
12787
'
12888
12989
{
130-
"_shards" : {
131-
"total" : 5,
132-
"successful" : 5,
133-
"failed" : 0
90+
"_shards": {
91+
"total": 5,
92+
"successful": 5,
93+
"failed": 0
13494
},
135-
"suggest" : [ {
136-
"text" : "とうk",
137-
"offset" : 0,
138-
"length" : 3,
139-
"options" : [ {
140-
"text" : "東京駅",
141-
"score" : 1.0
142-
} ]
143-
} ]
95+
"suggest": [
96+
{
97+
"text": "とうk",
98+
"offset": 0,
99+
"length": 3,
100+
"options": [
101+
{
102+
"text": "東京駅",
103+
"_index": "suggest_sample",
104+
"_type": "test",
105+
"_id": "1",
106+
"_score": 1,
107+
"_source": {
108+
"suggest": "東京駅"
109+
}
110+
}
111+
]
112+
}
113+
]
144114
}
145-
146115
```
147116

148117

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath "org.elasticsearch.gradle:build-tools:5.0.0-rc1"
8+
classpath "org.elasticsearch.gradle:build-tools:5.0.0"
99
}
1010
}
1111

@@ -15,15 +15,15 @@ repositories {
1515
}
1616

1717
group = 'org.elasticsearch.plugin'
18-
version = '5.0.0-rc1-SNAPSHOT'
18+
version = '5.0.0'
1919

2020
apply plugin: 'java'
2121
apply plugin: 'elasticsearch.esplugin'
2222
apply plugin: 'idea'
2323

2424
esplugin {
2525
name 'elasticsearch-japanese-suggester'
26-
description ''
26+
description 'Suggester for Japanese'
2727
classname 'org.elasticsearch.plugin.JapaneseSuggesterPlugin'
2828
}
2929

examples/example.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

examples/index.html

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/main/java/org/elasticsearch/plugin/JapaneseSuggesterPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public Map<String, AnalysisModule.AnalysisProvider<AnalyzerProvider<? extends An
3838
return analyzers;
3939
}
4040

41+
@Override
4142
public Map<String, Suggester<?>> getSuggesters() {
4243
return singletonMap("japanese_completion", JapaneseCompletionSuggester.INSTANCE);
4344
}

0 commit comments

Comments
 (0)