# MySQL tables with foreign key to Elastic App Search

**URL:** <https://discuss.elastic.co/t/mysql-tables-with-foreign-key-to-elastic-app-search/307769>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [June 21, 2022, 2:27pm UTC](https://discuss.elastic.co/t/mysql-tables-with-foreign-key-to-elastic-app-search/307769 "2022-06-21T14:27:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rustin\_Spencer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rustin_spencer/32/103495_2.png) [@Rustin\_Spencer](https://discuss.elastic.co/u/Rustin_Spencer)\
**Post date:** [June 21, 2022, 2:27pm UTC](https://discuss.elastic.co/t/mysql-tables-with-foreign-key-to-elastic-app-search/307769/1 "2022-06-21T14:27:03Z")

</div>

How can I manage the relation between 2 tables in Elastic App Search?  
I have to ingest data from MySQL DB from 2 tables which have foreign key to elastic app search engine. How do I do this?

---

<div class="post-metadata">

**Author:** ![Serena\_Chou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/serena_chou/32/100087_2.png) [@Serena\_Chou](https://discuss.elastic.co/u/Serena_Chou)\
**Post date:** [June 21, 2022, 6:25pm UTC](https://discuss.elastic.co/t/mysql-tables-with-foreign-key-to-elastic-app-search/307769/2 "2022-06-21T18:25:29Z")

</div>

Hey Rustin, do you have perhaps a few more details on what you're trying to accomplish? It sounds like you're saying you have to ingest data from two tables in your MySQL database. Are you ingesting that data into Elasticsearch? Into Elastic App Search or somewhere else? You mentioned that there's a foreign key in the data in those tables that map to an App Search engine, is this a field that you're looking to search or otherwise map the data... if so for what purpose?

---

<div class="post-metadata">

**Author:** ![Rustin\_Spencer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rustin_spencer/32/103495_2.png) [@Rustin\_Spencer](https://discuss.elastic.co/u/Rustin_Spencer)\
**Post date:** [June 22, 2022, 7:55am UTC](https://discuss.elastic.co/t/mysql-tables-with-foreign-key-to-elastic-app-search/307769/3 "2022-06-22T07:55:30Z")

</div>

I'm trying to ingest data into Elastic App Search. I ingested data using Logstash and set JDBC statement to query both table together binding with foreignKey\_A = foreignKey\_B.  
I need to search from the first table, but some of the data is in the related table.

---

<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:** [July 20, 2022, 7:56am UTC](https://discuss.elastic.co/t/mysql-tables-with-foreign-key-to-elastic-app-search/307769/4 "2022-07-20T07:56:10Z")

</div>

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