Snowball token filter

The snowball token filter is a stemming filter based on the Snowball 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:

  1. PUT /my-snowball-index
  2. {
  3. "settings": {
  4. "analysis": {
  5. "filter": {
  6. "my_snowball_filter": {
  7. "type": "snowball",
  8. "language": "English"
  9. }
  10. },
  11. "analyzer": {
  12. "my_snowball_analyzer": {
  13. "type": "custom",
  14. "tokenizer": "standard",
  15. "filter": [
  16. "lowercase",
  17. "my_snowball_filter"
  18. ]
  19. }
  20. }
  21. }
  22. }
  23. }

copy

Generated tokens

Use the following request to examine the tokens generated using the analyzer:

  1. GET /my-snowball-index/_analyze
  2. {
  3. "analyzer": "my_snowball_analyzer",
  4. "text": "running runners"
  5. }

copy

The response contains the generated tokens:

  1. {
  2. "tokens": [
  3. {
  4. "token": "run",
  5. "start_offset": 0,
  6. "end_offset": 7,
  7. "type": "<ALPHANUM>",
  8. "position": 0
  9. },
  10. {
  11. "token": "runner",
  12. "start_offset": 8,
  13. "end_offset": 15,
  14. "type": "<ALPHANUM>",
  15. "position": 1
  16. }
  17. ]
  18. }