Advice on cross field lookup


(Peng Chen) #1

Hi,
I have 2 document types,
Doc type 1 stores all information of each problem:
{
...
'_type': 'problems'
assignto: userabc,
reportby: usercde

...

}

Doc type 2 stores how users are grouped into different groups:
{ _type: 'user_group'
'groupname': 'group a'
'names': 'userabc', 'userddd', 'userbcd', ...]
}
{ _type: 'user_group'
'groupname': 'group b'
'names': 'userabc', 'usercde', 'userbcd', ...]
}
the same user can be existing in different groups

Is there way to filter issues by groups,
eg, listing all the issues in group a, or stat issues count in group a

It would be ok to restructure the data, but I found it difficult to justify usergroup type is a child of problem type. Would anyone be able to help me on this?


(Peng Chen) #2

Hi dear community,
Is there anyone can help me on this issue? It's quite blocking so far. Thanks a lot!
It's a one-Many relationship, which means I will have many user groups with people assigned to multiple groups, but for reporter or assignee, there will be only one people assigned.


(Alexander Reelsen) #3

there is support for parent-child relationships in Elasticsearch. Have you seen that and if so, does that fit your model or do you think it does not?


(Peng Chen) #4

Hi Alexander,
Thanks for the reply, I checked the doc and because each child need to specify its parent, I don't feel it will work in my case. I uploaded a diagram of the data strucuture. If you have any suggestions or how to apply this with parent child relationship, it will be very appreciated.


Both Doc type are under same index
The result I wish to get is when I filter with group A, it give me Ticket 1, when I filter with group B, it gives me Ticket 1 and Ticket 2
Thanks!


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.