前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >记录:Elasticsearch长文本keyword异常

记录:Elasticsearch长文本keyword异常

原创
作者头像
HLee
修改2021-07-23 11:00:22
1.1K0
修改2021-07-23 11:00:22
举报
文章被收录于专栏:房东的猫房东的猫

背景content.keyword字段使用keyword类型,在导数据的时候出现异常。

代码语言:javascript
复制
"content":{
       "type":"text",
       "fields":{
           "ansj":{
                "analyzer":"index_ansj_analyzer",
                "type":"text"
            },
            "trigram":{
                 "analyzer":"trigram_analyzer",
                 "type":"text"
            },
            "keyword":{
                  "type":"keyword"
            }
        }
}

异常信息:由于content是一个长文本,content.keyword字段类型为keyword,一个term不能容纳这么长的字符。

代码语言:javascript
复制
failure in bulk execution: [86]: index [retopic-21.07.06-001232], type [_doc], id [55015922], message [ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Document contains at least one immense term in field="content.keyword" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped.  Please correct the analyzer to not produce such terms.  The prefix of the first immense term is: '[-24, -65, -98, -27, -92, -89, -27, -92, -85, 44, -27, -66, -120, -24, -66, -101, -24, -117, -90, 44, -23, -103, -92, -28, -70, -122, -28, -72, -118, -25]...', original message: bytes can be at most 32766 in length; got 33424]]; nested: ElasticsearchException[Elasticsearch exception [type=max_bytes_length_exceeded_exception, reason=max_bytes_length_exceeded_exception: bytes can be at most 32766 in length; got 33424]];]

修改:直接去掉contentkeyword多字段。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
归档存储
腾讯云 COS 归档存储(COS Archive Storage)是腾讯云对象存储 COS 低成本、持久可靠的存储类型,为企业和个人开发者提供海量、非结构化数据的长时间备份能力。与本地备份相比,归档存储采用分布式云端存储架构,您无需关注硬件维护及容量扩展,当您需要数据时,可以通过 RESTful API 对存储的数据进行恢复并设置有效期来访问。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档