# Elasticsearch lookup email from different index

**URL:** <https://discuss.elastic.co/t/elasticsearch-lookup-email-from-different-index/279302>\
**Category:** Elasticsearch\
**Created:** [July 21, 2021, 6:17pm UTC](https://discuss.elastic.co/t/elasticsearch-lookup-email-from-different-index/279302 "2021-07-21T18:17:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jathin](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@Jathin](https://discuss.elastic.co/u/Jathin)\
**Post date:** [July 21, 2021, 6:17pm UTC](https://discuss.elastic.co/t/elasticsearch-lookup-email-from-different-index/279302/1 "2021-07-21T18:17:03Z")

</div>

```auto
PUT audit/doc
{
"userid": "some_guid",
"operation": "performed action a"
}

PUT audit/doc
{
"userid": "some_guid",
"operation": "performed action b"
}
PUT audit/doc
{
"userid": "some_guid",
"operation": "performed action c"
}
PUT user/doc
{
"userid": "some_guid",
"name": "someone",
"email": "someone@abc.com"
}

```

we have tons of records like above in user and audit table. i would like to create a report and return user with email [someone@abc.com](mailto:someone@abc.com) performed operation a, operation b, operation c. and same for all other users. how can we do this easily with elasitcsearch. my audit table is not flexible, but i can reindex my users table in different format to make it easier

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 22, 2021, 3:03pm UTC](https://discuss.elastic.co/t/elasticsearch-lookup-email-from-different-index/279302/2 "2021-07-22T15:03:38Z")

</div>

You cannot join the data of two indices at query time. However you could try to do that during index time using the enrich processor, see [Enrich processor | Elasticsearch Guide [7.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/enrich-processor.html)

---

<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:** [August 19, 2021, 3:04pm UTC](https://discuss.elastic.co/t/elasticsearch-lookup-email-from-different-index/279302/3 "2021-08-19T15:04:22Z")

</div>

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