Armenian analyzer

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

  1. PUT /arabic-index
  2. {
  3. "mappings": {
  4. "properties": {
  5. "content": {
  6. "type": "text",
  7. "analyzer": "armenian"
  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_armenian_analyzer
  2. {
  3. "settings": {
  4. "analysis": {
  5. "analyzer": {
  6. "stem_exclusion_armenian_analyzer": {
  7. "type": "armenian",
  8. "stem_exclusion": ["բարև", "խաղաղություն"]
  9. }
  10. }
  11. }
  12. }
  13. }

copy

Armenian analyzer internals

The armenian analyzer is built using the following components:

  • Tokenizer: standard

  • Token filters:

    • lowercase
    • stop (Armenian)
    • keyword
    • stemmer (Armenian)

Custom Armenian analyzer

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

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

copy

Generated tokens

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

  1. GET armenian-index/_analyze
  2. {
  3. "analyzer": "stem_exclusion_armenian_analyzer",
  4. "text": "բարև բոլորին, մենք խաղաղություն ենք ուզում և նոր օր ենք սկսել"
  5. }

copy

The response contains the generated tokens:

  1. {
  2. "tokens": [
  3. {"token": "բարև","start_offset": 0,"end_offset": 4,"type": "<ALPHANUM>","position": 0},
  4. {"token": "բոլոր","start_offset": 5,"end_offset": 12,"type": "<ALPHANUM>","position": 1},
  5. {"token": "խաղաղություն","start_offset": 19,"end_offset": 31,"type": "<ALPHANUM>","position": 3},
  6. {"token": "ուզ","start_offset": 36,"end_offset": 42,"type": "<ALPHANUM>","position": 5},
  7. {"token": "նոր","start_offset": 45,"end_offset": 48,"type": "<ALPHANUM>","position": 7},
  8. {"token": "օր","start_offset": 49,"end_offset": 51,"type": "<ALPHANUM>","position": 8},
  9. {"token": "սկսել","start_offset": 56,"end_offset": 61,"type": "<ALPHANUM>","position": 10}
  10. ]
  11. }