0
votes

I am using ES 5. With Nest lib on C#.

I have two indexes on ES. One have contact information and the other contact events. Each customer in my system can have lot of contacts and each contact can trigger a bigger number of events. Almost each contact action is an event.

I have all contanct information in a "Contact" index, and all my events information in an "Event" index.

So I have a search that can filter by contact information and by events. The problem that I have is how to join the two searchs, the one for contacts and the one for events, in one search.

Right now I have two queries, first I get the contacts that match, and then I search the events for those contact ids. The problem is that the first search can return thousents of contacts ids and I need to feed the second search with all those.

Is there a better way to do this? or should I re-think my indexes to for example store contact and events together and use a parent/child strategy?

1
what is the end goal of your query? To get all the events for contacts that match a search query?Russ Cam
the final goal is to get the contacts, but a lot of the contact information is saved as events, almost each contact action. So search will need to match contact info like name, lastName, etc and contact events, like if they saw an email, navigate to a page, etc.Adriano

1 Answers

0
votes

Yes, you need to choose between storing the data in one index or use parent-child schema, first way is faster, second way is more convenient when you have many events and add new events often. Still, it's better not to fetch all the events for those thousands of contacts you'd mentioned in a single query, use scroll API instead and fetch the data while you process it.