Skip to content

Commit

Permalink
Update usage
Browse files Browse the repository at this point in the history
  • Loading branch information
masaruh committed Jan 7, 2016
1 parent 21f80bb commit 3b7a275
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,29 @@ In order to install the plugin, run:
bin/plugin install https://github.com/masaruh/elasticsearch-japanese-suggester/releases/download/0.20.0/elasticsearch-japanese-suggester-0.20.0.zip
```

### Example
## Exampl Usage

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

### Create index (0.21.0 or below)

Use expand=true for indexing and expand=false for searching.
```sh
curl -XPUT 'http://localhost:9200/suggest_sample/' -d'
Expand Down Expand Up @@ -69,7 +91,7 @@ curl -XPUT 'http://localhost:9200/suggest_sample/test/_mapping' -d'
"properties": {
"suggest": {
"type": "japanese_completion",
"index_analyzer": "kuromoji_suggest_index",
"analyzer": "kuromoji_suggest_index",
"search_analyzer": "kuromoji_suggest_search",
"payloads": true
}
Expand All @@ -78,15 +100,15 @@ curl -XPUT 'http://localhost:9200/suggest_sample/test/_mapping' -d'
'
```

Feed document:
### Feed document
```sh
curl -XPUT 'http://localhost:9200/suggest_sample/test/1' -d'
{
"suggest":"東京駅"
}
```
And search:
### Search
```sh
curl -XPOST 'http://localhost:9200/suggest_sample/_suggest' -d'
{
Expand Down

0 comments on commit 3b7a275

Please sign in to comment.