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

相关推荐
阿里云大数据AI技术1 小时前
云栖实录|倍思科技 × 阿里云:让VOC洞察从“生成报告”走向“业务可用”
人工智能·elasticsearch·agent
数字新视界2 小时前
数据中心DCIM管理系统助力提升机房管理效率与安全性
大数据·人工智能·物联网·信息与通信·动环监控系统
阿里云大数据AI技术2 小时前
孩子王基于阿里云Data Agent的智能体实践:300+Agent 覆盖400+业务场景
大数据·人工智能·agent
大雪冬至686061258875 小时前
【一次 Elasticsearch 高基数聚合慢查询的定位与优化】
elasticsearch
武子康5 小时前
H3-World 扩展跳跃与开门:新动作怎样进入训练数据?
大数据·人工智能·算法
Elasticsearch6 小时前
Elasticsearch:如何使用 Connectors 接入数据到 Elastic Agent builder 里进行企业搜索
elasticsearch
软件技术NINI6 小时前
DeepSeek 大模型落地应用实战指南
大数据·人工智能
wuyk5558 小时前
Spider-第11讲-工程化改造与可维护性
大数据·爬虫·elasticsearch·搜索引擎
新*9 小时前
Elasticsearch 索引别名入门:创建、路由、原子切换与几个常见误解
运维·后端·elasticsearch·索引别名
墨林陌9 小时前
AI 热点日报(2026-11-16):黄仁勋或重返英伟达,华为发具身世界模型,ChatGPT Wallet打通支付
大数据