Lowercase token filter

Changes token text to lowercase. For example, you can use the lowercase filter to change THE Lazy DoG to the lazy dog.

In addition to a default filter, the lowercase token filter provides access to Lucene’s language-specific lowercase filters for Greek, Irish, and Turkish.

Example

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

  1. GET _analyze
  2. {
  3. "tokenizer" : "standard",
  4. "filter" : ["lowercase"],
  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 lowercase filter to configure a new custom analyzer.

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

Configurable parameters

language

(Optional, string) Language-specific lowercase token filter to use. Valid values include:

If not specified, defaults to Lucene’s LowerCaseFilter.

Customize

To customize the lowercase filter, duplicate it to create the basis for a new custom token filter. You can modify the filter using its configurable parameters.

For example, the following request creates a custom lowercase filter for the Greek language:

  1. PUT custom_lowercase_example
  2. {
  3. "settings": {
  4. "analysis": {
  5. "analyzer": {
  6. "greek_lowercase_example": {
  7. "type": "custom",
  8. "tokenizer": "standard",
  9. "filter": ["greek_lowercase"]
  10. }
  11. },
  12. "filter": {
  13. "greek_lowercase": {
  14. "type": "lowercase",
  15. "language": "greek"
  16. }
  17. }
  18. }
  19. }
  20. }