Фильтр токенов Classic
Выполняет необязательную пост-обработку терминов, сгенерированных токенайзером classic.
Этот фильтр удаляет английский притяжательный падеж ('s) в конце слов и удаляет точки из аббревиатур. Он использует классический фильтр Lucene ClassicFilter.
Пример
Следующий запрос к API анализа демонстрирует работу фильтра Classic.
resp = client.indices.analyze(
tokenizer="classic",
filter=[
"classic"
],
text="The 2 Q.U.I.C.K. Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp) response = client.indices.analyze(
body: {
tokenizer: 'classic',
filter: [
'classic'
],
text: "The 2 Q.U.I.C.K. Brown-Foxes jumped over the lazy dog's bone."
}
)
puts response const response = await client.indices.analyze({
tokenizer: "classic",
filter: ["classic"],
text: "The 2 Q.U.I.C.K. Brown-Foxes jumped over the lazy dog's bone.",
});
console.log(response); GET /_analyze
{
"tokenizer" : "classic",
"filter" : ["classic"],
"text" : "The 2 Q.U.I.C.K. Brown-Foxes jumped over the lazy dog's bone."
} Фильтр генерирует следующие токены:
[ The, 2, QUICK, Brown, Foxes, jumped, over, the, lazy, dog, bone ]
Добавление в анализатор
Следующий запрос к API создания индекса использует фильтр Classic для настройки нового пользовательского анализатора.
resp = client.indices.create(
index="classic_example",
settings={
"analysis": {
"analyzer": {
"classic_analyzer": {
"tokenizer": "classic",
"filter": [
"classic"
]
}
}
}
},
)
print(resp) response = client.indices.create(
index: 'classic_example',
body: {
settings: {
analysis: {
analyzer: {
classic_analyzer: {
tokenizer: 'classic',
filter: [
'classic'
]
}
}
}
}
}
)
puts response const response = await client.indices.create({
index: "classic_example",
settings: {
analysis: {
analyzer: {
classic_analyzer: {
tokenizer: "classic",
filter: ["classic"],
},
},
},
},
});
console.log(response); PUT /classic_example
{
"settings": {
"analysis": {
"analyzer": {
"classic_analyzer": {
"tokenizer": "classic",
"filter": [ "classic" ]
}
}
}
}
}
© 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-classic-tokenfilter.html