Dutch analyzer

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

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

copy

Dutch analyzer internals

The dutch analyzer is built using the following components:

  • Tokenizer: standard

  • Token filters:

    • lowercase
    • stop (Dutch)
    • keyword
    • stemmer_override
    • stemmer (Dutch)

Custom Dutch analyzer

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

  1. PUT /dutch-index
  2. {
  3. "settings": {
  4. "analysis": {
  5. "filter": {
  6. "dutch_stop": {
  7. "type": "stop",
  8. "stopwords": "_dutch_"
  9. },
  10. "dutch_stemmer": {
  11. "type": "stemmer",
  12. "language": "dutch"
  13. },
  14. "dutch_keywords": {
  15. "type": "keyword_marker",
  16. "keywords": []
  17. },
  18. "dutch_override": {
  19. "type": "stemmer_override",
  20. "rules": [
  21. "fiets=>fiets",
  22. "bromfiets=>bromfiets",
  23. "ei=>eier",
  24. "kind=>kinder"
  25. ]
  26. }
  27. },
  28. "analyzer": {
  29. "dutch_analyzer": {
  30. "type": "custom",
  31. "tokenizer": "standard",
  32. "filter": [
  33. "lowercase",
  34. "dutch_stop",
  35. "dutch_keywords",
  36. "dutch_override",
  37. "dutch_stemmer"
  38. ]
  39. }
  40. }
  41. }
  42. },
  43. "mappings": {
  44. "properties": {
  45. "content": {
  46. "type": "text",
  47. "analyzer": "dutch_analyzer"
  48. }
  49. }
  50. }
  51. }

copy

Generated tokens

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

  1. POST /dutch-index/_analyze
  2. {
  3. "field": "content",
  4. "text": "De studenten studeren in Nederland en bezoeken Amsterdam. Hun nummers zijn 123456."
  5. }

copy

The response contains the generated tokens:

  1. {
  2. "tokens": [
  3. {"token": "student","start_offset": 3,"end_offset": 12,"type": "<ALPHANUM>","position": 1},
  4. {"token": "studer","start_offset": 13,"end_offset": 21,"type": "<ALPHANUM>","position": 2},
  5. {"token": "nederland","start_offset": 25,"end_offset": 34,"type": "<ALPHANUM>","position": 4},
  6. {"token": "bezoek","start_offset": 38,"end_offset": 46,"type": "<ALPHANUM>","position": 6},
  7. {"token": "amsterdam","start_offset": 47,"end_offset": 56,"type": "<ALPHANUM>","position": 7},
  8. {"token": "nummer","start_offset": 62,"end_offset": 69,"type": "<ALPHANUM>","position": 9},
  9. {"token": "123456","start_offset": 75,"end_offset": 81,"type": "<NUM>","position": 11}
  10. ]
  11. }