# Temporary table alternative in elastic search

**URL:** https://discuss.elastic.co/t/temporary-table-alternative-in-elastic-search/127160
**Category:** Elasticsearch
**Created:** [April 7, 2018, 10:13am UTC](https://discuss.elastic.co/t/temporary-table-alternative-in-elastic-search/127160 "2018-04-07T10:13:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Vaibhav\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vaibhav_kumar/32/29730_2.png) [@Vaibhav\_Kumar](https://discuss.elastic.co/u/Vaibhav_Kumar)
#### Post date: [April 7, 2018, 10:13am UTC](https://discuss.elastic.co/t/temporary-table-alternative-in-elastic-search/127160/1 "2018-04-07T10:13:33Z")

</div>

I have a scenerio where i'm filtering some records from a table and reusing the same intermediate tables to join on a column. My query looks something like this

select \* from  
(select poscode from test where AccountNo='270679' )AS FD  
JOIN  
(select poscode from test where AccountNo!='270679')AS MD  
ON FD.poscode=MD.poscodE  
I can put two get request on my data but and get the result but how will i use the concept of temporary tables here in elastic search as i created two FD,MD in sql and put a join between them. I was able to get some info from [Here](https://stackoverflow.com/questions/27708612/elasticsearch-comparison-between-fields) but not sure how to put all that together

---

<div class="post-metadata">

### Author: ![Vaibhav\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vaibhav_kumar/32/29730_2.png) [@Vaibhav\_Kumar](https://discuss.elastic.co/u/Vaibhav_Kumar)
#### Post date: [April 7, 2018, 10:48am UTC](https://discuss.elastic.co/t/temporary-table-alternative-in-elastic-search/127160/2 "2018-04-07T10:48:36Z")

</div>

Any help on this would be appreciated. If someone can just give the idea whether this type of scenario could be achieved or not in elastic search?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 7, 2018, 11:03am UTC](https://discuss.elastic.co/t/temporary-table-alternative-in-elastic-search/127160/3 "2018-04-07T11:03:11Z")

</div>

Read [this](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

---

<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: [May 5, 2018, 11:03am UTC](https://discuss.elastic.co/t/temporary-table-alternative-in-elastic-search/127160/4 "2018-05-05T11:03:30Z")

</div>

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