当您有一个索引,其中的字段类型为通配符,并填充了西里尔字母数据,然后您使用case_sensitive执行通配符查询时:true,未找到文档。
注:目前在ES版本7.17.8中
测试示例:
PUT /index
{
"mappings": {
"properties": {
"name": {
"type": "wildcard"
}
}
}
}
POST /index/_doc/1
{
"name": "ТЕСТ"
}
POST /index/_search
{
"query": {
"bool": {
"must": [
{
"wildcard": {
"name": {
"value": "*Тест*",
"case_insensitive": true
}
}
}
]
}
}
}
我试图搜索修复,但找不到任何东西。有什么可以帮助解决这个问题吗?
注意:索引数据和查询数据都是西里尔字符。
西里尔文:
切塞茨-0xd0a2d095d0a1d0a2
特切什特-0xd0a2d0b5d181d182
而拉丁语则是:
TECT-0x54454354
总人数-0x54656374
1条答案
按热度按时间w7t8yxp51#
如果您使用ngram分析器,则在搜索时不需要添加通配符"*"。
要了解它的工作原理,可以使用
analyze
aPI您的小写"T"有问题:)。
Тест
=〉tect
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/keyword.html#wildcard-field-type
更多信息的一些注解:
通配符字段与关键字字段一样未标记化,因此不支持依赖于单词位置的查询(如短语查询)。运行通配符查询时,将忽略任何重写参数。得分始终为常数。