即使经过数小时的尝试理解 Elastic 搜索,我也无法理解如何为搜索带有特殊字符的文本获得相同的结果。
我做错了什么icu_folding?我怎样才能实现"斯柯达"和"斯柯达"的结果相同?甚至可能吗?
https://github.com/pavoltravnik/examples/blob/master/elastic_search_settings.sh
您将icu_folding
标记筛选器应用于name.sort
子字段,而不是name
字段本身,因此您的查询需要如下所示:
# 1 result as expected
curl -XGET 'localhost:9200/my_index/_search?pretty' -d'
{
"query": { "match": { "name.sort": "Škoda" } }
}'
# 0 results - I expected the same behaviour
curl -XGET 'localhost:9200/my_index/_search?pretty' -d'
{
"query": { "match": { "name.sort": "Skoda" } }
}'