我知道在弹性搜索中,我们可以在文档之间建立子/父关系.
然后,在索引时,我可以传递父ID,以便链接子文档和父文档:
$ curl -XPUT localhost:9200/blogs/blog_tag/1122?parent=1111 -d '{ "tag" : "something"}'
Run Code Online (Sandbox Code Playgroud)
无论如何,在弹性搜索中建立多对多的关系?
数据驻留在具有以下模式的MySQL数据库中:
account
========
id
name
some_property
group
========
id
name
description
account_group
=============
account_id
group_id
primary_group //This is 1 or 0 depending on whether the group is the primary group for that account.
Run Code Online (Sandbox Code Playgroud)
这是我目前的映射account(请原谅数组符号,我在PHP中使用Elastica与我的elasticsearch服务器通信):
**Mapping for account**
'name' => array(
'type' => 'string'),
'some_property' => array(
'type' => 'string'),
'groups' => array(
'properties' => array(
'id' => array('type' => 'integer'),
'primary' => …Run Code Online (Sandbox Code Playgroud)