gpt4 book ai didi

ElasticSearch:preserve_position_increments 不工作

转载 作者:行者123 更新时间:2023-12-02 22:15:53 25 4
gpt4 key购买 nike

根据文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html

preserve_position_increments=false 应该使字符串中的连续关键字可搜索。但对我来说它不起作用。这是一个错误吗?在 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"
}
}
}
}

如果是,我会做一个错误报告

最佳答案

这不是错误,preserve_position_increments 仅在您删除停用词并希望搜索停用词之后的标记时有用(即搜索 Beat 并找到甲壳虫乐队)。

在您的情况下,您可能应该索引 ["Nevermind", "Nirvana"] ,即标记数组。

如果您尝试索引 "The Nirvana",您将通过搜索 nir 找到它

关于ElasticSearch:preserve_position_increments 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52072317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com