Elasticsearch 篇之数据建模

数据建模简介


image.png

image.png

ES数据建模配置

image.png

enabled index index_options

norms doc_values field_data

norms是算分排序用的


store coerce multifields

dynamic date_detection

mapping字段属性的设定流程

是何种类型

image.png

是否排序和聚合分析

是否另行存储

ES数据建模实例

image.png

enabled

image.png

store

highlight store_fields

highlight store_fields示例

Nested_Object

ES处理关联关系的解决办法

传统处理办法

传统处理办法

ES

不使用nested Object的问题

默认是Object Array

Nested Object使用

查询nested Object path关键字

nested Object存储形式

Parent_Child

join

join

query

parent_id

has_child

has_parent

示例

放入父文档

放入子文档

查询

查询父文档ID为2的

has_child

has_parent

nested vs parent

reindex

reindex场景

update_by_query


reindex

reindex-task

task API

其他建议

在mapping中加入version,这样每个doc新建的时候就能赋值version了

加这个version字段有一个好处就是以后我们的mapping升级了,version字段对应的值+1,我们可以在查询的时候知道哪些是老版本的数据,哪些是新版本的数据。


字段过多的危害

key value

key value

key value

key value

key value
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容