大写词元过滤器 #
大写(uppercase
)词元过滤器用于在分析过程中将所有词元(单词)转换为大写形式。
参考样例 #
以下示例请求创建了一个名为 uppercase_example
的新索引,并配置了一个带有大写过滤器的分词器。
PUT /uppercase_example
{
"settings": {
"analysis": {
"filter": {
"uppercase_filter": {
"type": "uppercase"
}
},
"analyzer": {
"uppercase_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"uppercase_filter"
]
}
}
}
}
}
产生的词元 #
使用以下请求来检查使用该分词器生成的词元:
GET /uppercase_example/_analyze
{
"analyzer": "uppercase_analyzer",
"text": "Easysearch is powerful"
}
返回内容包含产生的词元
{
"tokens": [
{
"token": "EASYSEARCH",
"start_offset": 0,
"end_offset": 10,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "IS",
"start_offset": 11,
"end_offset": 13,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "POWERFUL",
"start_offset": 14,
"end_offset": 22,
"type": "<ALPHANUM>",
"position": 2
}
]
}