elasticsearch에서 우리는 문서간에 child/parent relationships을 가질 수 있음을 알고 있습니다. 색인 때 자녀와 부모 문서가 연결되도록 elasticsearch의 many to many relationships
그리고, 나는 부모 ID를 전달할 수 있습니다$ curl -XPUT localhost:9200/blogs/blog_tag/1122?parent=1111 -d '{ "tag" : "something"}'
가 elasticsearch 많은 관계로 많은 모델 어쨌든이 있나요?
데이터는 다음과 같은 스키마를 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.
이것은 현재 account
내 매핑 (내 elasticsearch 서버와 통신하기 위해 PHP에서 Elastica을 사용하고, 배열 표기법을 용서하시기 바랍니다) :이 방법
**Mapping for account**
'name' => array(
'type' => 'string'),
'some_property' => array(
'type' => 'string'),
'groups' => array(
'properties' => array(
'id' => array('type' => 'integer'),
'primary' => array('type' => 'boolean')
)
),
**Mapping for group**
'name' => array(
'type' => 'string'),
'description'=> array(
'type' => 'string')
문제는 그룹 인덱스에서 삭제 된 경우, 나는 각 계정을 통해 이동하고 각 계정에서 그룹 ID를 삭제해야한다는 것입니다. 이것은 나에게 비효율적 인 것으로 보인다. 또한 elasticsearch의 자식/부모 관계를 사용할 때 이것이 문제가되지 않는다고 생각합니다.
elasticsearch에서 다 대다 관계를 모델링하는 방법이 있습니까?