elasticsearch关联方式简介,elasticsearch关联
一:应用层连接(多索引,但是没有资料显示多个索引之间应该怎样关联,只能粗暴的当成一个文档)
$ params = [ “index” => “wp_weapp_users,wp_weapp_orders” , “type” => “wp_weapp_users,wp_weapp_orders” , “body” => $ json ] ;
二:非规范化数据(冗余)
将其他文档的数据统计出来,再根据关联字段,将统计结果更新到本数据(问题:数据量大时,的的foreach一条一条更新,速度慢)
三:嵌套对象(嵌套,子文档无法单独查询)
PUT / my_index { “映射”:{ “blogpost”:{ “properties”:{ “注释”:{ “type”:“嵌套”, “properties”:{ “name”:{“type”:“string”}, “comment”:{“type”:“string”}, “年龄”:{“type”:“short”}, “明星” :{“type”:“short”}, “date”:{“type”:“date”} } } } } } }
四:父子文档(创建一个索引/类型,6.0同一个索引下不能创建多个类型,更新为https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html)
PUT my_index { “映射”:{ “_doc”:{ “properties”:{ “my_join_field”:{ “type”:“加入”, “关系”:{ “问题”:“回答” } } } } } }复制作为控制台的卷曲视图
该字段的名称 | |
定义单个关系,其中 |
详情:HTTPS://www.elastic.co/guide/cn/elasticsearch/guide/current/relations.html
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。