![](/img/trans.png)
[英]ElasticSearch - match_phrase_prefix query with synonyms
[英]Why match_phrase_prefix query returns wrong results with diffrent length of phrase?
我有非常簡單的查詢:
POST /indexX/document/_search
{
"query": {
"match_phrase_prefix": {
"surname": "grab"
}
}
}
與映射:
"surname": {
"type": "string",
"analyzer": "polish",
"copy_to": [
"full_name"
]
}
和index的定義(我使用Stempel(波蘭語)分析Elasticsearch插件):
POST /indexX
{
"settings": {
"index": {
"analysis": {
"filter": {
"synonym" : {
"type": "synonym",
"synonyms_path": "analysis/synonyms.txt"
},
"polish_stop": {
"type": "stop",
"stopwords_path": "analysis/stopwords.txt"
},
"polish_my_stem": {
"type": "stemmer",
"rules_path": "analysis/stems.txt"
}
},
"analyzer": {
"polish_with_synonym": {
"tokenizer": "standard",
"filter": [
"synonym",
"lowercase",
"polish_stop",
"polish_stem",
"polish_my_stem"
]
}
}
}
}
}
}
對於此查詢,我得到零結果。 當我將短語更改為GRA或GRABA時,它將返回1個結果(GRABARZ是姓氏)。 為什么會這樣?
我嘗試了max_expansions,其值甚至高達1200,但沒有幫助。
乍一看,您的分析器會阻止搜索詞(“抓圖”)並使它不可用(“grabić”)。
如果沒有詳細說明如何解決這個問題,請考慮在這里擺脫拋光分析儀。 我們談論的是人們的名字,而不是“普通的”波蘭語單詞。
我看到了在這種情況下使用的不同技術:多字段搜索,模糊搜索,語音搜索,專用插件。
一些鏈接: https: //www.elastic.co/blog/multi-field-search-just-got-better http://www.basistech.com/fuzzy-search-names-in-elasticsearch/ https:// www.found.no/play/gist/6c6434c9c638a8596efa
但我想在波蘭名稱的情況下,在非分析字段上的某種前綴查詢就足夠了......
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.