0
我想得到一個分析儀與標準英語分析儀的行爲,也是一組詞應在搜索過程中的同義詞。elasticsarch同義詞過濾器與英文分析儀
這是我試過的定義:
{
"analysis": {
"filter": {
"synonym_en": {
"type": "synonym",
"synonyms": [
"universe, cosmos",
"women, woman",
"man, men"
]
},
"my_filter": {
"type": "word_delimiter",
"preserve_original": "false",
"split_on_numerics": "false"
}
},
"analyzer": {
"my_analyzer": {
"type": "custom",
"filter": [
"my_filter"
],
"tokenizer": "keyword"
},
"my_english": {
"type": "english",
"stopwords": [
"a",
"an",
"and",
"are",
"as",
"at",
"be",
"but",
"by",
"for",
"if",
"into",
"is",
"it",
"of",
"on",
"or",
"such",
"that",
"the",
"their",
"then",
"there",
"these",
"they",
"this",
"to",
"was",
"will",
"with"
],
"filter": [
"synonym_en"
]
}
}
}
}
但是我不能讓它拖的工作。的確,當我運行示例:
GET /my_index/_analyze?analyzer=my_english&text='Men'
它只返回令牌men
,而我想有兩個man
和men
。
也請注意,一個簡單的分析
{
"settings": {
"analysis": {
"filter": {
"my_synonym_filter": {
"type": "synonym",
"synonyms": [
"british,english",
"queen,monarch",
"man,men"
]
}
},
"analyzer": {
"my_synonyms": {
"tokenizer": "standard",
"filter": [
"lowercase",
"my_synonym_filter"
]
}
}
}
}
}
似乎工作,因爲它返回man
和men
。
我怎麼能從英文分析儀得到想要的行爲+?