根据文件所说
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html
preserve_position_increments=false应该使字符串中的连续关键字可搜索。但对我来说这是行不通的。这是一个bug吗?在Kibana复制的步骤:
PUT /example-index/
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"_doc": {
"properties": {
"example-suggest-field": {
"type": "completion",
"analyzer": "stop",
"preserve_position_increments": false,
"max_input_length": 50
}
}
}
}
}
PUT /example-index/_doc/1
{
"example-suggest-field": [
{
"input": "Nevermind Nirvana",
"weight" : 10
}
]
}
POST /example-index/_search
{
"suggest": {
"bib-suggest" : {
"prefix" : "nir",
"completion" : {
"field" : "example-suggest-field"
}
}
}
}
POST /example-index/_search
{
"suggest": {
"bib-suggest" : {
"prefix" : "nev",
"completion" : {
"field" : "example-suggest-field"
}
}
}
}如果是,我会写一份错误报告
发布于 2018-08-29 16:20:52
这不是bug,只有当你删除停用词并且想要搜索停用词后面的令牌时(即搜索Beat并查找The Beatles),preserve_position_increments才有用。
在您的例子中,您可能应该改为索引["Nevermind", "Nirvana"],即标记数组。
如果您尝试为"The Nirvana"建立索引,则可以通过搜索nir来找到它
https://stackoverflow.com/questions/52072317
复制相似问题