-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
9315105
commit b1920b0
Showing
2 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
layout: default | ||
title: Snowball | ||
parent: Token filters | ||
nav_order: 380 | ||
--- | ||
|
||
# Snowball token filter | ||
|
||
The `snowball` token filter is a stemming filter based on the [Snowball](https://snowballstem.org/) algorithm. It supports many languages and is more efficient and accurate than the Porter stemming algorithm. | ||
|
||
## Parameters | ||
|
||
The `snowball` token filter can be configured with a `language` parameter that accepts the following values: | ||
|
||
- `Arabic` | ||
- `Armenian` | ||
- `Basque` | ||
- `Catalan` | ||
- `Danish` | ||
- `Dutch` | ||
- `English` (default) | ||
- `Estonian` | ||
- `Finnish` | ||
- `French` | ||
- `German` | ||
- `German2` | ||
- `Hungarian` | ||
- `Italian` | ||
- `Irish` | ||
- `Kp` | ||
- `Lithuanian` | ||
- `Lovins` | ||
- `Norwegian` | ||
- `Porter` | ||
- `Portuguese` | ||
- `Romanian` | ||
- `Russian` | ||
- `Spanish` | ||
- `Swedish` | ||
- `Turkish` | ||
|
||
## Example | ||
|
||
The following example request creates a new index named `my-snowball-index` and configures an analyzer with a `snowball` filter: | ||
|
||
```json | ||
PUT /my-snowball-index | ||
{ | ||
"settings": { | ||
"analysis": { | ||
"filter": { | ||
"my_snowball_filter": { | ||
"type": "snowball", | ||
"language": "English" | ||
} | ||
}, | ||
"analyzer": { | ||
"my_snowball_analyzer": { | ||
"type": "custom", | ||
"tokenizer": "standard", | ||
"filter": [ | ||
"lowercase", | ||
"my_snowball_filter" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Generated tokens | ||
|
||
Use the following request to examine the tokens generated using the analyzer: | ||
|
||
```json | ||
GET /my-snowball-index/_analyze | ||
{ | ||
"analyzer": "my_snowball_analyzer", | ||
"text": "running runners" | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
The response contains the generated tokens: | ||
|
||
```json | ||
{ | ||
"tokens": [ | ||
{ | ||
"token": "run", | ||
"start_offset": 0, | ||
"end_offset": 7, | ||
"type": "<ALPHANUM>", | ||
"position": 0 | ||
}, | ||
{ | ||
"token": "runner", | ||
"start_offset": 8, | ||
"end_offset": 15, | ||
"type": "<ALPHANUM>", | ||
"position": 1 | ||
} | ||
] | ||
} | ||
``` |