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

相关推荐
渣渣盟1 天前
Flink Table API与SQL流数据处理实战
大数据·sql·flink·scala
疯狂成瘾者1 天前
上传到 GitHub 的步骤总结
大数据·elasticsearch·github
七夜zippoe1 天前
OpenClaw 接入 WhatsApp:消息推送实战
大数据·人工智能·microsoft·whatsapp·openclaw
RFID科技的魅力1 天前
从开箱到实战:CP300R触屏RFID打印机全场景使用测评
大数据·人工智能·物联网·rfid
Elasticsearch1 天前
Elasticsearch:如何在 workflow 里调用一个 agent
elasticsearch
Forrit1 天前
Agent长期运行(Long-Running Tasks)实现方案与核心挑战
大数据·人工智能·深度学习
2601_955363152 天前
技术赋能B端拓客:号码核验的行业困局与破局路径氪迹科技法人股东筛选系统,阶梯式价格
大数据·人工智能
财经资讯数据_灵砚智能2 天前
全球财经资讯日报(夜间-次晨)2026年3月28日
大数据·人工智能·python·语言模型·ai编程