# Cross referencing from multiple indexes

**URL:** <https://discuss.elastic.co/t/cross-referencing-from-multiple-indexes/267164>\
**Category:** Elasticsearch\
**Created:** [March 13, 2021, 9:32pm UTC](https://discuss.elastic.co/t/cross-referencing-from-multiple-indexes/267164 "2021-03-13T21:32:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevvvlar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevvvlar/32/85511_2.png) [@kevvvlar](https://discuss.elastic.co/u/kevvvlar)\
**Post date:** [March 13, 2021, 9:32pm UTC](https://discuss.elastic.co/t/cross-referencing-from-multiple-indexes/267164/1 "2021-03-13T21:32:02Z")

</div>

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.

```auto
/user_profile/abc12345

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

```

```auto
/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?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 17, 2021, 8:18am UTC](https://discuss.elastic.co/t/cross-referencing-from-multiple-indexes/267164/2 "2021-03-17T08:18:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 14, 2021, 8:18am UTC](https://discuss.elastic.co/t/cross-referencing-from-multiple-indexes/267164/3 "2021-04-14T08:18:40Z")

</div>

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