You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Elasticsearch创建快照失败求助:触发snapshot_creation_exception异常

Elasticsearch快照创建失败:Unmatched second part of surrogate pair 问题排查

问题描述

执行命令创建Elasticsearch快照:

curl -XPUT http://elk:9200/_snapshot/aws_repo/snapshot_19429

操作此前可正常运行,当前抛出500错误,报错详情:

{
  "error": {
    "root_cause": [
      {
        "type": "snapshot_creation_exception",
        "reason": "[aws_repo:snapshot_19429/N04u4RyBRtmDchd3lgZaMw] failed to create snapshot"
      }
    ],
    "type": "snapshot_creation_exception",
    "reason": "[aws_repo:snapshot_19429/N04u4RyBRtmDchd3lgZaMw] failed to create snapshot",
    "caused_by": {
      "type": "i_o_exception",
      "reason": "Unmatched second part of surrogate pair (0xDEA1)",
      "suppressed": [
        {
          "type": "illegal_state_exception",
          "reason": "Failed to close the XContentBuilder",
          "caused_by": {
            "type": "i_o_exception",
            "reason": "Unclosed object or array found"
          }
        }
      ]
    }
  },
  "status": 500
}

错误分析

核心错误Unmatched second part of surrogate pair (0xDEA1)指向无效的Unicode代理对字符:

  • Unicode代理对是两个UTF-16字符的组合(0xD800-0xDBFF为高代理,0xDC00-0xDFFF为低代理),单独出现其中一个就会触发编码错误
  • 该错误发生在快照创建时的元数据/文档序列化阶段,导致XContentBuilder无法正常关闭,最终中断快照创建流程

排查与解决步骤

  • 排查可疑索引:
    • 检查近期新增、修改的索引,重点确认索引名称、mapping字段名是否包含孤立的代理对字符
    • 对可疑索引执行文档扫描,定位包含无效Unicode编码的文档,清理或修正数据
  • 验证数据完整性:
    • 使用_validate/query API验证索引数据的合法性,示例:
      curl -XGET http://elk:9200/problem_index/_validate/query?q=*&explain
      
  • 版本兼容性检查:
    • 旧版本Elasticsearch存在Unicode编码处理bug,若使用版本较老,建议升级至对应分支的稳定小版本
  • 临时规避方案:
    • 若已定位到问题索引,创建快照时排除该索引:
      curl -XPUT http://elk:9200/_snapshot/aws_repo/snapshot_19429 \
      -H "Content-Type: application/json" \
      -d '{
        "indices": "-problem_index_name"
      }'
      

内容的提问来源于stack exchange,提问作者Dmitrii Podlipaev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 06:05:25