Skip to content

Commit

Permalink
Documentation was expanded a bit: full example posted.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgambal committed Sep 19, 2015
1 parent 359f21a commit 94309c6
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 3 deletions.
84 changes: 82 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Installation of the plugin consists of only 4 steps:
* Clone this repository
* Get inside the root dir of cloned repo and run ```gradle release```
* Find built artifact in ```build/distributions/```
* Import it into your ES installation with ```<pathh_to_es_bin_dir>/plugin --url <path_to_distribution>/elasticsearch-ukrainian-lemmatizer-1.0-SNAPSHOT.zip --install ukrainian-lemmatizer```
* Import it into your ES installation with ```<path_to_es_bin_dir>/plugin --url <path_to_distribution>/elasticsearch-ukrainian-lemmatizer-1.0-SNAPSHOT.zip --install ukrainian-lemmatizer```

**Example**: ```./plugin --url file:///home/mrgambal/projects/elasticsearch-ukrainian-lemmagen/build/distributions/elasticsearch-ukrainian-lemmatizer-1.0-SNAPSHOT.zip --install ukrainian-lemmatizer```


## Usage
Expand All @@ -41,6 +43,49 @@ curl -XPUT "http://localhost:9200/ukrainian/" -d '
'
```

Then we create some simple mapping:

```bash
# Define mapping
curl -XPOST "http://localhost:9200/ukrainian/user/_mapping" -d '
{
"user":{
"_all":{
"analyzer":"ukrainian"
},
"properties":{
"test":{
"type":"string",
"analyzer":"ukrainian"
}
}
}
}
'
```

And fill the index with sample data:

```bash
# Create Documents
curl -XPOST "http://localhost:9200/ukrainian/user/" -d '
{
"test":"гусятам"
}'
curl -XPOST "http://localhost:9200/ukrainian/user/" -d '
{
"test":"підострожує"
}'
curl -XPOST "http://localhost:9200/ukrainian/user/" -d '
{
"test":"гусяти"
}'
curl -XPOST "http://localhost:9200/ukrainian/user/" -d '
{
"test":"п’яничка"
}'
```

Having that done and filled this index with some data we may query it using the same analyzer:

```bash
Expand All @@ -59,7 +104,42 @@ curl -XPOST "http://localhost:9200/ukrainian/user/_search?pretty=true" -d '
'
```

**Notice** you may find complete example in ```test.sh``` inside the repository: you may use it for testing of serviceability of the plugin after you install it.
And here is what you'll receive:

```json
{
"took": 111,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1.0,
"hits": [{
"_index": "ukrainian",
"_type": "user",
"_id": "AU_mWjT6wMGwUI93ytgK",
"_score": 1.0,
"_source": {
"test": "гусяти"
}
}, {
"_index": "ukrainian",
"_type": "user",
"_id": "AU_mWicgwMGwUI93ytgI",
"_score": 0.30685282,
"_source": {
"test": "гусятам"
}
}]
}
}
```

**Notice** you may find this particular example in ```test.sh``` inside the repository: you may use it for testing of serviceability of the plugin after you install it.

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ curl -XPOST "http://localhost:9200/ukrainian/user/" -d '
}'
curl -XPOST "http://localhost:9200/ukrainian/user/" -d '
{
"test":"Сергій"
"test":"гусяти"
}'
curl -XPOST "http://localhost:9200/ukrainian/user/" -d '
{
Expand Down

0 comments on commit 94309c6

Please sign in to comment.