Estonian analyzer

The built-in estonian analyzer can be applied to a text field using the following command:

  1. PUT /estonian-index
  2. {
  3. "mappings": {
  4. "properties": {
  5. "content": {
  6. "type": "text",
  7. "analyzer": "estonian"
  8. }
  9. }
  10. }
  11. }

copy

Stem exclusion

You can use stem_exclusion with this language analyzer using the following command:

  1. PUT index_with_stem_exclusion_estonian_analyzer
  2. {
  3. "settings": {
  4. "analysis": {
  5. "analyzer": {
  6. "stem_exclusion_estonian_analyzer": {
  7. "type": "estonian",
  8. "stem_exclusion": ["autoriteet", "kinnitus"]
  9. }
  10. }
  11. }
  12. }
  13. }

copy

Estonian analyzer internals

The estonian analyzer is built using the following components:

  • Tokenizer: standard

  • Token filters:

    • lowercase
    • stop (Estonian)
    • keyword
    • stemmer (Estonian)

Custom Estonian analyzer

You can create a custom Estonian analyzer using the following command:

  1. PUT /estonian-index
  2. {
  3. "settings": {
  4. "analysis": {
  5. "filter": {
  6. "estonian_stop": {
  7. "type": "stop",
  8. "stopwords": "_estonian_"
  9. },
  10. "estonian_stemmer": {
  11. "type": "stemmer",
  12. "language": "estonian"
  13. },
  14. "estonian_keywords": {
  15. "type": "keyword_marker",
  16. "keywords": []
  17. }
  18. },
  19. "analyzer": {
  20. "estonian_analyzer": {
  21. "type": "custom",
  22. "tokenizer": "standard",
  23. "filter": [
  24. "lowercase",
  25. "estonian_stop",
  26. "estonian_keywords",
  27. "estonian_stemmer"
  28. ]
  29. }
  30. }
  31. }
  32. },
  33. "mappings": {
  34. "properties": {
  35. "content": {
  36. "type": "text",
  37. "analyzer": "estonian_analyzer"
  38. }
  39. }
  40. }
  41. }

copy

Generated tokens

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

  1. POST /estonian-index/_analyze
  2. {
  3. "field": "content",
  4. "text": "Õpilased õpivad Tallinnas ja Eesti ülikoolides. Nende numbrid on 123456."
  5. }

copy

The response contains the generated tokens:

  1. {
  2. "tokens": [
  3. {"token": "õpilase","start_offset": 0,"end_offset": 8,"type": "<ALPHANUM>","position": 0},
  4. {"token": "õpi","start_offset": 9,"end_offset": 15,"type": "<ALPHANUM>","position": 1},
  5. {"token": "tallinna","start_offset": 16,"end_offset": 25,"type": "<ALPHANUM>","position": 2},
  6. {"token": "eesti","start_offset": 29,"end_offset": 34,"type": "<ALPHANUM>","position": 4},
  7. {"token": "ülikooli","start_offset": 35,"end_offset": 46,"type": "<ALPHANUM>","position": 5},
  8. {"token": "nende","start_offset": 48,"end_offset": 53,"type": "<ALPHANUM>","position": 6},
  9. {"token": "numbri","start_offset": 54,"end_offset": 61,"type": "<ALPHANUM>","position": 7},
  10. {"token": "on","start_offset": 62,"end_offset": 64,"type": "<ALPHANUM>","position": 8},
  11. {"token": "123456","start_offset": 65,"end_offset": 71,"type": "<NUM>","position": 9}
  12. ]
  13. }