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

相关推荐
无忧智库2 小时前
某公共大数据资源中心平台建设项目可行性研究方案(PPT)
大数据
诗词在线4 小时前
求推荐飞花令
大数据·人工智能·python
湘美书院--湘美谈教育4 小时前
湘美谈教育AI系列经验集锦:赋能整理聊斋志异大寓言
大数据·人工智能·深度学习·神经网络·机器学习
jrjrgood4 小时前
现货黄金和黄金期货的区别有哪些?如何投资?
大数据·人工智能·区块链
清辞8535 小时前
Coze从入门到实战---第一、二章
大数据·人工智能·学习·语言模型
TomatoStudy6 小时前
IT职业教育AI落地与实训体系建设复盘——以职坐标模式为例
大数据·人工智能
Java 码思客6 小时前
【ElasticSearch从入门到架构师】第1章:ElasticSearch 核心认知与行业定位
大数据·elasticsearch·搜索引擎
cui17875687 小时前
物业费收缴困局的破题之路:2026年社区商业逻辑的底层重构
大数据·数据库·人工智能
2501_933670797 小时前
大数据在校实训项目一般做什么类型内容
大数据
monsion7 小时前
Loop Engineering:你不再 prompt agent,而是设计 prompt agent 的系统
大数据·人工智能·prompt