elasticsearch 关联查询对比
admin
2023-07-31 17:20:10
0

两种方式 嵌套和父子关联


Nested

  • Nested docs are stored in the same Lucene block as each other, which helps read/query performance. Reading a nested doc is faster than the equivalent parent/child.

  • Updating a single field in a nested document (parent or nested children) forces ES to reindex the entire nested document. This can be very expensive for large nested docs

  • "Cross referencing" nested documents is impossible

  • Best suited for data that does not change frequently

Parent/Child

  • Children are stored separately from the parent, but are routed to the same shard. So parent/children are slightly less performance on read/query than nested

  • Parent/child mappings have a bit extra memory overhead, since ES maintains a "join" list in memory

  • Updating a child doc does not affect the parent or any other children, which can potentially save a lot of indexing on large docs

  • Sorting/scoring can be difficult with Parent/Child since the Has Child/Has Parent operations can be opaque at times


综上所述,两种方式均有利弊,官方建议,自己处理关联关系,减轻ES的压力。

相关内容

热门资讯

克宫:俄罗斯永不会发动第三次世... 据凤凰卫视报道,俄罗斯克里姆林宫7月7日指出,在土耳其举行的北约峰会上的涉俄言论具有对抗性,缺乏建设...
托稳“医”线牵挂 “暑”你快乐... 7月7日上午,黄河科技学院附属医院第三期职工子女暑期托管班正式开班。医院党委书记于春霞,行政后勤部部...
苏巧慧呛新北别拿台当局补助,李... 海峡导报综合报道 台当局行政机构前负责人苏贞昌6年前承诺台当局“全额负担”新庄电影文化中心二期,如今...
美军对伊朗军事设施发动打击后,... 新华社德黑兰7月8日电 据伊朗媒体8日报道,巴林传出多次爆炸声。报道没有提供更多细节,巴林方面尚未有...
美心门换智能锁坏了怎么办 美心门换智能锁坏了怎么办:智能锁被锁定。一般超过3次密码、指纹输入不正确智能锁会进入锁定状态。面板显...
剪力墙的作用及误拆处理方法 剪力墙是承担竖向和水平荷载的重要结构墙体,在房屋建设中起到关键作用。误拆剪力墙可能导致结构安全问题,...
长虹电视机故障码怎么解决 电视机故障码是指当电视机出现故障时,通常会有一个特定的错误代码显示在屏幕上,以帮助用户更轻松地诊断问...
大1p空调和1.5p的区别 问题:大1p空调和1.5p的区别回答:1、功率不同:大1匹的消耗功率约为813W,1.5匹的消耗功率...
冰箱压缩机运转的时候加氟应该加... 冰箱压缩机运转的时候加氟应该加到多少?一般情况下冰箱加氟至少五年加一次,但是具体需要加多少量,得根据...
国际足联对美国队两名工作人员实... 【环球网报道】国际足联(FIFA)突然宣布暂缓执行对美国队前锋巴洛贡的红牌禁赛处罚引发轩然大波之际,...