-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lowercase token filter docs #8162
Merged
kolchfa-aws
merged 6 commits into
opensearch-project:main
from
AntonEliatra:add-lowercase-token-filter-docs
Dec 2, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5dddda8
add lowercase token filter
AntonEliatra 167d063
adding examples in greek to lowercase token filter #8154
AntonEliatra 9a46d9a
Update lowercase.md
AntonEliatra f39b925
Doc review
kolchfa-aws b0ce7c1
Apply suggestions from code review
kolchfa-aws 0a98c60
Merge branch 'main' into add-lowercase-token-filter-docs
kolchfa-aws File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
layout: default | ||
title: Lowercase | ||
parent: Token filters | ||
nav_order: 260 | ||
--- | ||
|
||
# Lowercase token filter | ||
|
||
The `lowercase` token filter is used to convert all characters in the token stream to lowercase, making searches case insensitive. | ||
|
||
## Parameters | ||
|
||
The `lowercase` token filter can be configured with the following parameter. | ||
|
||
Parameter | Required/Optional | Description | ||
:--- | :--- | :--- | ||
`language` | Optional | Specifies a language-specific token filter. Valid values are: <br>- [`greek`](https://lucene.apache.org/core/8_7_0/analyzers-common/org/apache/lucene/analysis/el/GreekLowerCaseFilter.html) <br>- [`irish`](https://lucene.apache.org/core/8_7_0/analyzers-common/org/apache/lucene/analysis/ga/IrishLowerCaseFilter.html) <br>- [`turkish`](https://lucene.apache.org/core/8_7_0/analyzers-common/org/apache/lucene/analysis/tr/TurkishLowerCaseFilter.html). <br> Default is the [Lucene LowerCaseFilter](https://lucene.apache.org/core/8_7_0/analyzers-common/org/apache/lucene/analysis/core/LowerCaseFilter.html). | ||
|
||
## Example | ||
|
||
The following example request creates a new index named `custom_lowercase_example`. It configures an analyzer with a `lowercase` filter and specifies `greek` as the `language`: | ||
|
||
```json | ||
PUT /custom_lowercase_example | ||
{ | ||
"settings": { | ||
"analysis": { | ||
"analyzer": { | ||
"greek_lowercase_example": { | ||
"type": "custom", | ||
"tokenizer": "standard", | ||
"filter": ["greek_lowercase"] | ||
} | ||
}, | ||
"filter": { | ||
"greek_lowercase": { | ||
"type": "lowercase", | ||
"language": "greek" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Generated tokens | ||
|
||
Use the following request to examine the tokens generated using the analyzer: | ||
|
||
```json | ||
GET /custom_lowercase_example/_analyze | ||
{ | ||
"analyzer": "greek_lowercase_example", | ||
"text": "Αθήνα ΕΛΛΑΔΑ" | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
The response contains the generated tokens: | ||
|
||
```json | ||
{ | ||
"tokens": [ | ||
{ | ||
"token": "αθηνα", | ||
"start_offset": 0, | ||
"end_offset": 5, | ||
"type": "<ALPHANUM>", | ||
"position": 0 | ||
}, | ||
{ | ||
"token": "ελλαδα", | ||
"start_offset": 6, | ||
"end_offset": 12, | ||
"type": "<ALPHANUM>", | ||
"position": 1 | ||
} | ||
] | ||
} | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 18: Is
english
also an option, or is that the default used by the Lucene filter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default without specifying a language.