elasticsearch -- mapping(动态映射)

Dynamic field mapping (动态字段类型映射)

ES 官方文档地址

  • 个人理解:
    本篇主要描述的是 ES会根据保存的字段动态的设置字段类型,不像MySQL创建表时需要定义字段类型

Date detection 数据检测(默认开启)

  • _mapping 命令:查看文档中各个字段的数据类型

    PUT my-index-000001/_doc/1
    {
    "create_date": "2015/09/02"
    }

    GET my-index-000001/_mapping

Disabling date detection 关闭数据检测

复制代码
PUT my-index-000001
{
  "mappings": {
    "date_detection": false
  }
}

PUT my-index-000001/_doc/1 
{
  "create_date": "2015/09/02"
}

Customizing detected date formats 自定义时间格式检测

复制代码
PUT my-index-000001
{
  "mappings": {
    "dynamic_date_formats": [ "yyyy/MM", "MM/dd/yyyy"]
  }
}

PUT my-index-000001/_doc/1
{
  "create_date": "09/25/2015"
}

Numeric detection 数值检测

  • 开启数值检测(默认情况下是关闭的)

    PUT my-index-000001
    {
    "mappings": {
    "numeric_detection": true
    }
    }

    PUT my-index-000001/_doc/2
    {
    "my_float": "8.0",
    "my_integer": "88"
    }

    GET my-index-000001/_mapping

相关推荐
Elasticsearch9 小时前
Kibana 中的 SNMP 拓扑数据:从采集到 Canvas
elasticsearch
大大大大晴天15 小时前
Hudi技术内幕:RecordPayload到RecordMerger
大数据
SelectDB1 天前
秒级弹性、最高降本 70%:SelectDB Serverless 如何重塑云数仓资源效率
大数据·后端·云原生
WhoAmI1 天前
MapReduce框架原理解析一:InputFormat
大数据·hadoop
WhoAmI1 天前
MapReduce框架原理解析三:OutputFormat
大数据·hadoop
WhoAmI1 天前
MapReduce框架原理解析二:Shuffle
大数据·hadoop
大大大大晴天2 天前
Hudi技术内幕:Key Generation原理与实践
大数据
Elasticsearch2 天前
3个信号、2个环境变量、0个采集器:使用 Python 和 Elastic 的托管 OTLP 端点实现 OpenTelemetry
elasticsearch
Elasticsearch4 天前
如何通过 Claude Code 来写入 CSV 数据到 Elasticsearch
elasticsearch