Storing user based events in elasticsearch


We are building a events data store on top of elasticsearch. Our goal is to provide real-time analytics with advanced segmentation on top of users & events. Our entities are

  1. Users or Visitors
  2. Events (Which is performed by Users, which will be above 100 - 1000)


"first_name": "John",
"email": "",
"country": "US",
"user_id": 100

"event_name": "Add To Cart",
"user_id": 100,
"product_name": "IPhone X"

I tried 2 options

  1. Nested Documents, a concern is user attributes will not be modified frequently. But, events will be performed very frequently. Let's say a user will perform 1000+ events, so the same doc will be updated more than 1000 times.

  2. Parent-Child Relationship, not satisfying segmentation

Possible Queries:

  1. Give me the user ids, who is in the US and performed "Add To Cart" & product name is "iPhone X"

With nested documents, it is working out well. But parent-child, I couldn't able to perform the search on parent & child at the same time.

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