ElasticSearch autocomplete/suggest 按令牌
ElasticSearch autocomplete/suggest by token
我想根据索引中存在的 标记(而非完整文档)创建搜索建议。
例如:
我有一个 movies 的简单索引,其中有这两个文档:
{"name":"Captain America"}
{"name":"American Made"}
如果我输入 "ame" 那么我应该得到两个建议(作为标记)
america
american
同样,如果我输入 "cap",那么我应该得到 "captain" 而不是 "Captain America"
I am having exact same problem as this post:
https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392
我浏览了所有类型的建议者,他们似乎专注于 return 整个文档而不是标记。
Apache Solr 通过其自动建议功能满足此要求:
例如,如果我键入“kni
”,那么 Solr 会将 return knives
、knife
和 knit
作为建议(基于标记来自索引文档)
{
"responseHeader":{
"status":0,
"QTime":19},
"spellcheck":{
"suggestions":[
"kni",{
"numFound":3,
"startOffset":0,
"endOffset":3,
"suggestion":["knives",
"knife",
"knit"]}],
"collations":[
"collation","knives"]}}
One of the probable solution is mentioned in this Whosebug thread:
Elasticsearch autocomplete or autosuggest by token
But it relies on explicitly adding all the suggestions in every document. This seems to be a tedious approach.
请让我知道是否可以通过某种更好的方式实现这一目标。
提前致谢。
当您搜索“ame”时,它不会 return 美国部分,因为它存储为“美国队长”。你得到存储的原始文本
您需要将其存储为仅美国。
在您的情况下,字段名称的值为“美国队长”。
如果您为其应用文本字段类型,它可能会为您创建标记,例如美国队长、美国等。
这些是在编制索引时创建的令牌,旨在帮助您search/auto 建议。
作为搜索或自动提示的响应,您将获得原文。
尽管另一种方法是从自动建议的原始文本的响应中突出显示匹配的术语或部分术语。
我想根据索引中存在的 标记(而非完整文档)创建搜索建议。
例如: 我有一个 movies 的简单索引,其中有这两个文档:
{"name":"Captain America"}
{"name":"American Made"}
如果我输入 "ame" 那么我应该得到两个建议(作为标记)
america
american
同样,如果我输入 "cap",那么我应该得到 "captain" 而不是 "Captain America"
I am having exact same problem as this post: https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392
我浏览了所有类型的建议者,他们似乎专注于 return 整个文档而不是标记。
Apache Solr 通过其自动建议功能满足此要求:
例如,如果我键入“kni
”,那么 Solr 会将 return knives
、knife
和 knit
作为建议(基于标记来自索引文档)
{
"responseHeader":{
"status":0,
"QTime":19},
"spellcheck":{
"suggestions":[
"kni",{
"numFound":3,
"startOffset":0,
"endOffset":3,
"suggestion":["knives",
"knife",
"knit"]}],
"collations":[
"collation","knives"]}}
One of the probable solution is mentioned in this Whosebug thread: Elasticsearch autocomplete or autosuggest by token
But it relies on explicitly adding all the suggestions in every document. This seems to be a tedious approach.
请让我知道是否可以通过某种更好的方式实现这一目标。
提前致谢。
当您搜索“ame”时,它不会 return 美国部分,因为它存储为“美国队长”。你得到存储的原始文本
您需要将其存储为仅美国。
在您的情况下,字段名称的值为“美国队长”。 如果您为其应用文本字段类型,它可能会为您创建标记,例如美国队长、美国等。
这些是在编制索引时创建的令牌,旨在帮助您search/auto 建议。
作为搜索或自动提示的响应,您将获得原文。
尽管另一种方法是从自动建议的原始文本的响应中突出显示匹配的术语或部分术语。