Lowercase token filter
editLowercase token filter
editChanges 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
editThe following analyze API request uses the default
lowercase
filter to change the THE Quick FoX JUMPs
to lowercase:
response = client.indices.analyze( body: { tokenizer: 'standard', filter: [ 'lowercase' ], text: 'THE Quick FoX JUMPs' } ) puts response
GET _analyze { "tokenizer" : "standard", "filter" : ["lowercase"], "text" : "THE Quick FoX JUMPs" }
The filter produces the following tokens:
[ the, quick, fox, jumps ]
Add to an analyzer
editThe following create index API request uses the
lowercase
filter to configure a new
custom analyzer.
response = client.indices.create( index: 'lowercase_example', body: { settings: { analysis: { analyzer: { whitespace_lowercase: { tokenizer: 'whitespace', filter: [ 'lowercase' ] } } } } } ) puts response
PUT lowercase_example { "settings": { "analysis": { "analyzer": { "whitespace_lowercase": { "tokenizer": "whitespace", "filter": [ "lowercase" ] } } } } }
Configurable parameters
edit-
language
-
(Optional, string) Language-specific lowercase token filter to use. Valid values include:
-
greek
- Uses Lucene’s GreekLowerCaseFilter
-
irish
- Uses Lucene’s IrishLowerCaseFilter
-
turkish
- Uses Lucene’s TurkishLowerCaseFilter
If not specified, defaults to Lucene’s LowerCaseFilter.
-
Customize
editTo 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:
response = client.indices.create( index: 'custom_lowercase_example', body: { settings: { analysis: { analyzer: { greek_lowercase_example: { type: 'custom', tokenizer: 'standard', filter: [ 'greek_lowercase' ] } }, filter: { greek_lowercase: { type: 'lowercase', language: 'greek' } } } } } ) puts response
PUT custom_lowercase_example { "settings": { "analysis": { "analyzer": { "greek_lowercase_example": { "type": "custom", "tokenizer": "standard", "filter": ["greek_lowercase"] } }, "filter": { "greek_lowercase": { "type": "lowercase", "language": "greek" } } } } }