ES-mapping

类似数据库中的表结构定义,主要作用如下

定义Index下的字段名( Field Name)

定义字段的类型,比如数值型、字符串型、布尔型等定义倒排索引相关的配置,比如是否索引、记录 position 等

index_options 用于控制倒排索记录的内容,有如下4种配置

  • docs 只记录 doc id

  • freqs 记录 doc id 和 term frequencies

  • positions 记录 doc id、term frequencies 和 term position

-offsets 记录 doc id、term frequencies、term position character offsets·

text类型默认配置为 positions,其他默认为 docs。记录内容越多,占用空间越大

核心数据类型

字符串型 text、keyword

数值型 long、integer、short、 byte、 double、 float、 half float、 scaled_float

日期类型 date

布尔类型 boolean

二进制类型 binary

范围类型 integer_range、float_range、long_range、double_range、date_range

复杂数据类型

专用类型

-记录i 地址 ip

-实现自动补全 completion

-记录分词数 token_count

-记录字符串hash值murmur3

-percolator

-join

允许根据 es 自动识别的数据类型、字段名等来动态设定字段类型,可以实现如下效果

所有字符串类型都设定为 keyword 类型,即默认不分词

所有以message开头的字段都设定为 text 类型,即分词

所有以long_开头的字段都设定为 long类型

所有自动匹配为 double 类型的都设定为 float 类型,以节省空间

匹配规则一般有如下几个参数

match_mapping_type 匹配es 自动识别的字段类型,如boolean,long,string等

match,unmatch 匹配字段名

path_match,path_unmatch 匹配路径

索引模板,英文为Index Template,主要用于在新建索引时自动应用预先设定的配置简化索引创建的操作步骤

可以设定索引的配置和mapping

可以有多个模板,根据order 设置,order 大的覆盖小的配置

相关推荐
Sayai20 小时前
Elasticsearch 日志索引设计:按小时切分 + 小时内 Rollover 兜底(ILM 实战,附完整脚本)
大数据·elasticsearch·搜索引擎
Elasticsearch20 小时前
生产环境向量搜索的一个设置:vectordb_document 模式如何自动调优 Elasticsearch
elasticsearch
【赫兹威客】浩哥21 小时前
基于SpringBoot+Vue3的舆情文本分析系统|Elasticsearch检索+情感分析+话题热度追踪 毕设项目
spring boot·elasticsearch·课程设计
玉&心1 天前
在grafana中加入elasticsearch的日志dashboard
elasticsearch·grafana
Elasticsearch1 天前
让大模型思考,让小模型执行:在 Elastic Workflows 中拆分 LLM 成本
elasticsearch
Elastic 中国社区官方博客1 天前
ES95:面向 Elasticsearch 时间序列指标的自适应压缩
大数据·运维·elasticsearch·搜索引擎·架构·全文检索
编程令我快乐1 天前
模型配置及使用ccSwich管理
大数据·elasticsearch·搜索引擎
可遇_不可求2 天前
合集:LangChain智能体开发(四)langchain-elasticsearch
elasticsearch·langchain
Elasticsearch2 天前
悦高软件带你体验 ES9.5 的性能跃升之路
elasticsearch
Elastic 中国社区官方博客2 天前
跳过 mapping 爆炸:ES|QL 无需动态 mapping 即可查询无 schema JSON key
大数据·人工智能·sql·elasticsearch·搜索引擎·json·全文检索