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

Elasticsearch/Kibana无64位无符号整数类型适配问题求助

Fixing uint64 Indexing Errors in Elasticsearch/Kibana

Got it, let's resolve this uint64 indexing issue you're facing. The error you're seeing makes perfect sense: Elasticsearch's long type is a signed 64-bit integer, which tops out at 9223372036854775807—but your uint64 values (like 9223372036856872997) blow past that limit, hence the json_parse_exception during indexing.

The Solution: Use Elasticsearch's unsigned_long Type

Starting from Elasticsearch 7.0, there's a built-in data type made exactly for this scenario: unsigned_long. It supports values from 0 up to 18446744073709551615—a perfect match for your uint64 variable.

Here's how to implement this fix step by step:

  1. Update Your Elasticsearch Index Template
    Swap the long type for your fileid field with unsigned_long:

    "fileid": { "type": "unsigned_long" },
    

    Important: If the index already exists, you can't modify the field type directly. You'll need to either create a new index with the updated template or use the reindex API to migrate existing data to a new index with the correct mapping.

  2. Validate Your Beater Code Serialization
    Your existing Beater code uses a uint64 type with the JSON tag json:"#FileId":

    FileId uint64 `json:"#FileId"`
    

    Ensure your JSON serializer (like Go's standard encoding/json) outputs the uint64 as a numeric value (not a string). Go's default JSON handling does this correctly, so no changes should be needed here—but double-check to avoid accidental string conversion, which would break the unsigned_long parsing.

  3. Test the Fix
    After updating the template and deploying your code, try indexing those problematic values again. The mapper_parsing_exception should disappear, and your uint64 values will be stored correctly. In Kibana, you'll be able to use the fileid field for filtering, sorting, and visualizations just like any other numeric field.

Key Notes

  • If you're stuck on an Elasticsearch version older than 7.0, unsigned_long isn't available. Your only fallback is to store the uint64 as a string, but this will lose numeric querying capabilities (like range filters)—so upgrading to a newer ES version is strongly recommended.
  • The unsigned_long type supports all standard numeric operations in Elasticsearch, so you won't lose any functionality compared to using long for valid signed values.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 07:04:19