美文网首页工作生活
Elasticsearch 篇之数据建模

Elasticsearch 篇之数据建模

作者: 青衣敖王侯 | 来源:发表于2019-06-30 14:16 被阅读0次

数据建模简介


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

相关文章

网友评论

    本文标题:Elasticsearch 篇之数据建模

    本文链接:https://www.haomeiwen.com/subject/mfapcctx.html