elasticsearch - ElasticSearch 没有在字段 [field_name] 上声明的类型 [search_as_you_type] 的处理程序
问题描述
我正在尝试使用 EslasticSearch 实现自动完成功能,并遵循 search-as-you-type 文档:
当我在下面运行映射查询时,出现异常。
PUT my-index-000001
{
"mappings": {
"properties": {
"my_field": {
"type": "search_as_you_type"
}
}
}
}
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "No handler for type [search_as_you_type] declared on field [my_field]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: No handler for type [search_as_you_type] declared on field [my_field]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "No handler for type [search_as_you_type] declared on field [my_field]"
}
},
"status": 400
}
是文档提供了错误的映射查询还是我做错了什么?
解决方案
search_as_you_type
type 字段是在 7.2 版本中引入的
由于您使用的是 elasticsearch 版本 5,因此您收到以下错误
“原因”:“没有在字段 [my_field] 上声明的类型 [search_as_you_type] 的处理程序
推荐阅读
- android - Flutter firestore QuerySnapshot 在 Android 中没有 getter 'documents' 的实例
- python - 如何在不使用内置函数的情况下计算协方差和相关性?
- angular - 在 Angular 10 服务中创建 TemplateRef
- nsis - 知道一个部分是否已经执行了另一个部分
- linux - Bash 条件表达式 (-v) 检查是否设置了变量
- ios - iOS 企业分发证书创建不会创建私钥
- user-interface - 带有图标的 ionic UI 迷你固定侧边栏
- numpy - For循环在np 3d数组上获得总和和平均值
- python - 如何使用 Discord 机器人更改 Discord 服务器的通知设置?
- excel - Excel - 如何手动计算每秒工作表?