文章目录
1. Completion Suggester 简介
有关不使用 suggest 者的更灵活的search-as-you-type类型的搜索,请参阅search_as_you_type字段类型。
completion suggester 提供自动completion/search-as-you-type功能。这是一项导航功能,就是提示词功能,可在用户键入内容时指导他们获得相关结果,从而提高搜索精度。它不适用于term suggest或者phrase suggest拼写纠正或“您是否要说”功能。
理想情况下,自动completion功能应与用户键入的速度一样快,以提供与用户已经键入的内容相关的即时反馈。因此,completion suggester 的速度得到了优化。completion suggester使用的数据结构可实现快速查找,但构建成本很高,并且存储在内存中。
In order to understand the format of suggestions, please read the Suggesters page first. For more flexible search-as-you-type searches that do not use suggesters, see the search_as_you_type field type.
The completion suggester provides auto-complete/search-as-you-type functionality. This is a navigational feature to guide users to relevant results as they are typing, improving search precision. It is not meant for spell correction or did-you-mean functionality like the term or phrase suggesters.
Ideally, auto-complete functionality should be as fast as a user types to provide instant feedback relevant to what a user has already typed in. Hence, completion suggester is optimized for speed. The suggester uses data structures that enable fast lookups, but are costly to build and are stored in-memory.
Mapping
使用这个feature需要为字段定义特殊的mapping
To use this feature, specify a special mapping for this field, which indexes the field values for fast completions.
PUT music
{
"mappings": {
"properties" : {
"suggest" : {
"type" : "completion"
},
"title" : {
"type": "keyword"
}
}
}
}
Copy as cURL
View in Console
Mapping supports the following parameters:
1.analyzer :index analyzer,默认为simple
The index analyzer to use, defaults to simple.
2.search_analyzer: 默认同analyzer
3.preserve_separators
保留分隔符,默认为true。如果禁用,则使用foof进行suggest查找,则可以找到以Foo Fighters开头的字段。
Preserves the separators, defaults to true. If disabled, you could find a field starting with Foo F

本文详细介绍了CompletionSuggester在Elasticsearch中的功能,包括自动完成、存储文档、查询方法、跳过重复建议及模糊和正则查询的支持。通过实例演示了如何配置和优化这种导航特性,以提高用户搜索体验。
最低0.47元/天 解锁文章
807

被折叠的 条评论
为什么被折叠?



