Lithuanian analyzer

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

  1. PUT /lithuanian-index
  2. {
  3. "mappings": {
  4. "properties": {
  5. "content": {
  6. "type": "text",
  7. "analyzer": "lithuanian"
  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_lithuanian_analyzer
  2. {
  3. "settings": {
  4. "analysis": {
  5. "analyzer": {
  6. "stem_exclusion_lithuanian_analyzer": {
  7. "type": "lithuanian",
  8. "stem_exclusion": ["autoritetas", "patvirtinimas"]
  9. }
  10. }
  11. }
  12. }
  13. }

copy

Lithuanian analyzer internals

The lithuanian analyzer is built using the following components:

  • Tokenizer: standard

  • Token filters:

    • lowercase
    • stop (Lithuanian)
    • keyword
    • stemmer (Lithuanian)

Custom Lithuanian analyzer

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

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

copy

Generated tokens

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

  1. POST /lithuanian-index/_analyze
  2. {
  3. "field": "content",
  4. "text": "Studentai mokosi Lietuvos universitetuose. Jų numeriai yra 123456."
  5. }

copy

The response contains the generated tokens:

  1. {
  2. "tokens": [
  3. {"token": "student","start_offset": 0,"end_offset": 9,"type": "<ALPHANUM>","position": 0},
  4. {"token": "mok","start_offset": 10,"end_offset": 16,"type": "<ALPHANUM>","position": 1},
  5. {"token": "lietuv","start_offset": 17,"end_offset": 25,"type": "<ALPHANUM>","position": 2},
  6. {"token": "universitet","start_offset": 26,"end_offset": 41,"type": "<ALPHANUM>","position": 3},
  7. {"token": "num","start_offset": 46,"end_offset": 54,"type": "<ALPHANUM>","position": 5},
  8. {"token": "123456","start_offset": 59,"end_offset": 65,"type": "<NUM>","position": 7}
  9. ]
  10. }