# Count of orders in a certain state

**URL:** <https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943>\
**Category:** Kibana\
**Created:** [August 4, 2017, 6:50pm UTC](https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943 "2017-08-04T18:50:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jessxyz](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jessxyz](https://discuss.elastic.co/u/jessxyz)\
**Post date:** [August 4, 2017, 6:50pm UTC](https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943/1 "2017-08-04T18:50:15Z")

</div>

I have data coming into elastic search throughout the day. Each data consist of an order or an order update. For example: Order A created, Order B created, Order A processed, Order A Shipped, etc...  
The state of the order goes from created, processed then shipped.  
I have the field order\_id and order\_status for each document. I want to have a count of the orders that are CURRENTLY in the processed state.  
How would I be able to do that? Also I am using Kibana 4.6.4  
Thanks!

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [August 4, 2017, 9:35pm UTC](https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943/2 "2017-08-04T21:35:59Z")

</div>

Unfortunately I don't think you can do this with just one index pattern. Is it possible for you to create another index pattern which will have an update for order\_status at the end of the day? Then we can use scripted fields to get processed value and then do a data table viz on it to get the count per day.

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![jessxyz](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jessxyz](https://discuss.elastic.co/u/jessxyz)\
**Post date:** [August 7, 2017, 2:33pm UTC](https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943/3 "2017-08-07T14:33:18Z")

</div>

Hi thanks for the response!  
If data is coming through real time that tells us the status of an order, do you have an idea on how I can differentiate the latest orders to only go into one index? It seems a bit complicated where I would have to tell Order A created to go into the new index but when Order A processed comes in, I would move Order A created to another index and put Order A processed in the new index.

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [August 9, 2017, 1:57pm UTC](https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943/4 "2017-08-09T13:57:41Z")

</div>

Hi,

This is definitely data modeling question. I will see if I can get help.  
If I don't though would you mind asking in ES discussion forum?

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![jessxyz](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jessxyz](https://discuss.elastic.co/u/jessxyz)\
**Post date:** [August 9, 2017, 2:13pm UTC](https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943/5 "2017-08-09T14:13:17Z")

</div>

Thank you so much! Any help would be appreciative!

---

<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:** [September 6, 2017, 2:13pm UTC](https://discuss.elastic.co/t/count-of-orders-in-a-certain-state/95943/6 "2017-09-06T14:13:36Z")

</div>

Closed on September 6, 2017, 2:13pm UTC

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