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

相关推荐
Data-Miner19 分钟前
集团数字化转型大数据平台整体建设方案
大数据
guslegend40 分钟前
大模型驱动大数据SRE智能运维
大数据·运维
跨境小彭2 小时前
2026 Temu 合规新玩法,凌风 ERP 优化 POD 运营效率
大数据·跨境电商·temu·shein
weixin_397574092 小时前
从“点状试点“到“全面智能化“:制造企业AI落地的现实路径
大数据·人工智能·制造
志栋智能3 小时前
超自动化巡检:知识沉淀与团队协作的新载体
大数据·运维·网络·数据库·人工智能·自动化
Old Uncle Tom4 小时前
循环工程(loop engineering)
大数据
跨境数据猎手4 小时前
淘宝大数据技术在电商行业的应用
大数据
阿部多瑞 ABU4 小时前
铁三角:泛二次元奶头乐经济的结构分析及其人口后果
大数据·人工智能
吴卫斌4 小时前
波动率控制仓位系列(一):满仓轮动的“过山车”困境
大数据·python·股票·量化交易
AI焦点4 小时前
2026年AI应用架构:如何避坑并选对API聚合中转服务?
大数据·人工智能·架构