我有多个产品的弹性指数宽度分别为10英寸,10英寸,10英寸。在搜索10英寸笔记本电脑时,搜索查询向我提供了所有具有10英寸但包括10英寸的结果(因为我正在使用标记生成器为空白)。但是,要求将所有10英寸,10英寸和10英寸都获得。我不是在寻找只描述10的东西。
以下是设置:
"settings": {
"index": {
"analysis": {
"filter": {
"synonym": {
"type": "synonym",
"synonyms" : [
"\", inch, inches"
]
},
"stopfilter": {
"type": "stop",
"stopwords": [
"and",
"the"
]
},
"stemmer": {
"type": "stemmer",
"name": "minimal_english"
}
},
"analyzer": {
"synonym_stemmer": {
"filter": [
"lowercase",
"asciifolding",
"synonym",
"stopfilter"
],
"tokenizer": "whitespace"
},
"synonym_stemmer_std": {
"filter": [
"lowercase",
"asciifolding",
"synonym",
"stopfilter",
"stemmer"
],
"tokenizer": "standard"
}
}
}
}
}
但是在重新编制索引时,出现错误:
{
"index": "products-2019.08.08.0.00",
"type": "doc",
"id": "DDA16D00HO",
"cause": {
"type": "illegal_argument_exception",
"reason": "failed to build synonyms",
"caused_by": {
"type": "parse_exception",
"reason": "Invalid synonym rule at line 1",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "term: \" was completely eliminated by analyzer"
}
}
},
"status": 400
},
我尝试创建10英寸到10英寸的同义词,它可以正常工作,但是由于我将标记生成器用作空格而失败,因此它也再次搜索10。 而且我也不想这样的同义词,我想要一个通用的“英寸/英寸”。
如果“”是带有转义字符的第一个字母,为什么会出现此异常,如何获得所需的结果。