【发布时间】:2017-06-04 11:53:12
【问题描述】:
我对 elasticsearch 和数据的索引/检索方式有疑问。我不明白会发生什么。
这是我使用的映射(抱歉,它是 yaml 格式): 从理论上讲,这个想法很简单......我有一个带有小写和 asciifolding 过滤器的字符串分析器。我不想关心大小写或重音,我想使用这个分析器来索引和搜索。
settings:
index:
analysis:
filter:
autocomplete_filter:
type: edgeNGram
side: front
min_gram: 1
max_gram: 20
analyzer:
autocomplete:
type: custom
tokenizer: standard
filter: [lowercase, asciifolding, autocomplete_filter]
string_analyzer:
type: custom
tokenizer: standard
filter: [lowercase, asciifolding]
types:
city:
mappings:
cityName:
type: string
analyzer: string_analyzer
search_analyzer: string_analyzer
location: {type: geo_point}
当我运行这个查询时:
{
"query": {
"prefix":{
"cityName":"per"
}
}
,
"size":20
}
我得到一些结果,例如“Perpezat”、“Pern”、“Péreuil”,这是例外结果。
但如果我运行以下查询:
{
"query": {
"prefix":{
"cityName":"pér"
}
}
,
"size":20
}
然后我根本没有得到任何结果。
如果您有任何线索或帮助,我很乐意知道。 谢谢
【问题讨论】:
标签: elasticsearch