I have documents with these fields
- id
- userId
- userFirstName
- userLastName
- userEmail
- projectId
which is something like a many to many, where multiple documents with the same userId can exist.
I need to retrieve all the documents which are unique by userId, I am interested in all user fields, I can ignore project.
If it was relational I would done something like SELECT DISTINCT(userId), userFirstName, userLastName FROM users; but in ES I am not sure. Looking into aggregations but can not make it work yet.
A little help please 
Thank you!