@@ -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
0 commit comments