Uppercase token filter

The uppercase token filter is used to convert all tokens (words) to uppercase during analysis.

Example

The following example request creates a new index named uppercase_example and configures an analyzer with an uppercase filter:

  1. PUT /uppercase_example
  2. {
  3. "settings": {
  4. "analysis": {
  5. "filter": {
  6. "uppercase_filter": {
  7. "type": "uppercase"
  8. }
  9. },
  10. "analyzer": {
  11. "uppercase_analyzer": {
  12. "type": "custom",
  13. "tokenizer": "standard",
  14. "filter": [
  15. "lowercase",
  16. "uppercase_filter"
  17. ]
  18. }
  19. }
  20. }
  21. }
  22. }

copy

Generated tokens

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

  1. GET /uppercase_example/_analyze
  2. {
  3. "analyzer": "uppercase_analyzer",
  4. "text": "OpenSearch is powerful"
  5. }

copy

The response contains the generated tokens:

  1. {
  2. "tokens": [
  3. {
  4. "token": "OPENSEARCH",
  5. "start_offset": 0,
  6. "end_offset": 10,
  7. "type": "<ALPHANUM>",
  8. "position": 0
  9. },
  10. {
  11. "token": "IS",
  12. "start_offset": 11,
  13. "end_offset": 13,
  14. "type": "<ALPHANUM>",
  15. "position": 1
  16. },
  17. {
  18. "token": "POWERFUL",
  19. "start_offset": 14,
  20. "end_offset": 22,
  21. "type": "<ALPHANUM>",
  22. "position": 2
  23. }
  24. ]
  25. }