Cross referencing from multiple indexes

I am building an app where I need to match users based on several parameters. I have two elastic search indexes, one with the user's likes and dislikes, one with some metadata about the user.

/user_profile/abc12345

{
"userId": "abc12345",
"likes": ["chocolate", "vanilla", "strawberry"]
}
/user_metadata/abc12345

{
"userId": "abc12345",
"seenBy": ["aaa123","bbb123", "ccc123"] // Potentially hundreds of thousands of userIds
}

I was advised to make these separate indexes and cross reference them, but how do I do that? For example I want to search for users who like chocolate and have NOT been seen by user abc123. How do I write this query?

As Elasticsearch does not support joins that will most likely require multiple requests.

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