Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›Text analysis ›Token filter reference

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:

resp = client.indices.analyze(
    tokenizer="standard",
    filter=[
        "uppercase"
    ],
    text="the Quick FoX JUMPs",
)
print(resp)
response = client.indices.analyze(
  body: {
    tokenizer: 'standard',
    filter: [
      'uppercase'
    ],
    text: 'the Quick FoX JUMPs'
  }
)
puts response
const response = await client.indices.analyze({
  tokenizer: "standard",
  filter: ["uppercase"],
  text: "the Quick FoX JUMPs",
});
console.log(response);
GET _analyze
{
  "tokenizer" : "standard",
  "filter" : ["uppercase"],
  "text" : "the Quick FoX JUMPs"
}

The filter produces the following tokens:

[ THE, QUICK, FOX, JUMPS ]

Add to an analyzer

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

resp = client.indices.create(
    index="uppercase_example",
    settings={
        "analysis": {
            "analyzer": {
                "whitespace_uppercase": {
                    "tokenizer": "whitespace",
                    "filter": [
                        "uppercase"
                    ]
                }
            }
        }
    },
)
print(resp)
response = client.indices.create(
  index: 'uppercase_example',
  body: {
    settings: {
      analysis: {
        analyzer: {
          whitespace_uppercase: {
            tokenizer: 'whitespace',
            filter: [
              'uppercase'
            ]
          }
        }
      }
    }
  }
)
puts response
const response = await client.indices.create({
  index: "uppercase_example",
  settings: {
    analysis: {
      analyzer: {
        whitespace_uppercase: {
          tokenizer: "whitespace",
          filter: ["uppercase"],
        },
      },
    },
  },
});
console.log(response);
PUT uppercase_example
{
  "settings": {
    "analysis": {
      "analyzer": {
        "whitespace_uppercase": {
          "tokenizer": "whitespace",
          "filter": [ "uppercase" ]
        }
      }
    }
  }
}

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/analysis-uppercase-tokenfilter.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API