# Query ideas for my usecase to find order status

**URL:** <https://discuss.elastic.co/t/query-ideas-for-my-usecase-to-find-order-status/225469>\
**Category:** Elasticsearch\
**Created:** [March 27, 2020, 10:30pm UTC](https://discuss.elastic.co/t/query-ideas-for-my-usecase-to-find-order-status/225469 "2020-03-27T22:30:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajsolanki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajsolanki/32/86859_2.png) [@rajsolanki](https://discuss.elastic.co/u/rajsolanki)\
**Post date:** [March 27, 2020, 10:30pm UTC](https://discuss.elastic.co/t/query-ideas-for-my-usecase-to-find-order-status/225469/1 "2020-03-27T22:30:38Z")

</div>

Firstly sorry if i m asking elementary questions and bit long question.

So i have a need for some sort of join query ( i know Elasticsearch is not RDBMS ) so i m looking for ideas.

So here are my few sample docs.

> {  
> "client":"A",  
> "type":"order",  
> "ordernum":"1234",  
> "status":"",  
> "ReceivedTimestamp" : "2020-03-267T14:30:51.844"  
> }
> 
> {  
> "client":"A",  
> "type":"order",  
> "ordernum":"1234",  
> "status":"acknowledged",  
> "ReceivedTimestamp" : "2020-03-26T14:31:51.844"  
> }
> 
> {  
> "client":"A",  
> "type":"order",  
> "ordernum":"1234",  
> "status":"shipped",  
> "ReceivedTimestamp" : "2020-03-27T11:00:51.844"  
> }  
> {  
> "client":"B",  
> "type":"order",  
> "ordernum":"4567",  
> "status":"",  
> "ReceivedTimestamp" : "2020-03-267T15:30:51.844"  
> }
> 
> {  
> "client":"B",  
> "type":"order",  
> "ordernum":"4567",  
> "status":"acknowledged",  
> "ReceivedTimestamp" : "2020-03-267T15:31:51.844"  
> }
> 
> {  
> "client":"B",  
> "type":"order",  
> "ordernum":"4567",  
> "status":"shipped",  
> "ReceivedTimestamp" : "2020-03-27T11:00:51.844"  
> }  
> {  
> "client":"A",  
> "type":"order",  
> "ordernum":"7890",  
> "status":"",  
> "ReceivedTimestamp" : "2020-03-27T12:00:51.844"  
> }

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/7/c772a819259b226c0eeff0b342a3e3a4fa40178b.png)

So what i m looking for is to write a query which would give me result of all orders which have not been acknowledged for client A in say last 15 mins . So if i break the query

step 1 search for all docs matching client : "A"

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/2/92e9ce16210c359fec337dd13ba8677d6e5cc369.png)

step 2 out of that result search for docs i i have to find ordernum which has not been in status : acknowledgement.

so should i have separate index for type order ? i.e orderindex, ackindex and shippedindex ? then do some sort of nested join ? or what ever i m trying its not possibe at all ?

---

<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 24, 2020, 10:30pm UTC](https://discuss.elastic.co/t/query-ideas-for-my-usecase-to-find-order-status/225469/2 "2020-04-24T22:30:54Z")

</div>

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