Uppercase token filter

Changes token text to uppercase. For example, you can use the uppercase filter to change the Lazy DoG to THE LAZY DOG.

This filter uses Lucene’s UpperCaseFilter.

Depending on the language, an uppercase character can map to multiple lowercase characters. Using the uppercase filter could result in the loss of lowercase character information.

To avoid this loss but still have a consistent letter case, use the lowercase filter instead.

Example

The following analyze API request uses the default uppercase filter to change the the Quick FoX JUMPs to uppercase:

  1. GET _analyze
  2. {
  3. "tokenizer" : "standard",
  4. "filter" : ["uppercase"],
  5. "text" : "the Quick FoX JUMPs"
  6. }

The filter produces the following tokens:

  1. [ THE, QUICK, FOX, JUMPS ]

Add to an analyzer

The following create index API request uses the uppercase filter to configure a new custom analyzer.

  1. PUT uppercase_example
  2. {
  3. "settings": {
  4. "analysis": {
  5. "analyzer": {
  6. "whitespace_uppercase": {
  7. "tokenizer": "whitespace",
  8. "filter": [ "uppercase" ]
  9. }
  10. }
  11. }
  12. }
  13. }