# Run a simple sql group by query in kibana 4

**URL:** <https://discuss.elastic.co/t/run-a-simple-sql-group-by-query-in-kibana-4/21211>\
**Category:** Elasticsearch\
**Created:** [December 11, 2014, 1:07pm UTC](https://discuss.elastic.co/t/run-a-simple-sql-group-by-query-in-kibana-4/21211 "2014-12-11T13:07:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PMOPMO](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@PMOPMO](https://discuss.elastic.co/u/PMOPMO)\
**Post date:** [December 11, 2014, 1:07pm UTC](https://discuss.elastic.co/t/run-a-simple-sql-group-by-query-in-kibana-4/21211/1 "2014-12-11T13:07:59Z")

</div>

Hello all,  
I want to run a simple _sql group by query_ in kibana 4 "Discover" page.  
Each record in my elastic search index represent a log and has 3 columns:  
process\_id (not unique value), log\_time, log\_message.

example:

process\_id log\_time log\_message

* * *

1 2014/12/11 01:00 msg1  
1 2014/12/11 01:10 msg2  
1 2014/12/11 01:20 msg3  
2 2014/12/11 11:00 msg4  
2 2014/12/11 11:10 msg5

I want to generate a table in kibana that looks like:

process\_id first log\_time last log\_time

* * *

* * *

1 2014/12/11 01:00 2014/12/11 01:20  
2 2014/12/11 11:00 2014/12/11 01:10

In sql the query is simple:  
select process\_id, max(log\_time), min(log\_time)  
from logs\_table  
group by process\_id

How can I run this query in Kibana? Is it possible to run the query in  
"Discover" page or should I create a panel (Visualize page)?

thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7474c2a2-0a55-4a30-b0b2-a5271997288c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7474c2a2-0a55-4a30-b0b2-a5271997288c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![PMOPMO](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@PMOPMO](https://discuss.elastic.co/u/PMOPMO)\
**Post date:** [December 14, 2014, 6:36am UTC](https://discuss.elastic.co/t/run-a-simple-sql-group-by-query-in-kibana-4/21211/2 "2014-12-14T06:36:36Z")

</div>

any ideas?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f991dd6e-9a37-4943-a055-39e2e1ed9621%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f991dd6e-9a37-4943-a055-39e2e1ed9621%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![PMOPMO](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@PMOPMO](https://discuss.elastic.co/u/PMOPMO)\
**Post date:** [January 21, 2015, 9:12am UTC](https://discuss.elastic.co/t/run-a-simple-sql-group-by-query-in-kibana-4/21211/3 "2015-01-21T09:12:09Z")

</div>

any update?

On Thursday, December 11, 2014 at 3:07:59 PM UTC+2, PMOPMO wrote:

> Hello all,  
> I want to run a simple _sql group by query_ in kibana 4 "Discover" page.  
> Each record in my Elasticsearch index represent a log and has 3 columns:  
> process\_id (not unique value), log\_time, log\_message.
> 
> example:
> 
> process\_id log\_time log\_message
> 
> * * *
> 
> 1 2014/12/11 01:00 msg1  
> 1 2014/12/11 01:10 msg2  
> 1 2014/12/11 01:20 msg3  
> 2 2014/12/11 11:00 msg4  
> 2 2014/12/11 11:10 msg5
> 
> I want to generate a table in kibana that looks like:
> 
> process\_id first log\_time last log\_time
> 
> * * *
> 
> * * *
> 
> 1 2014/12/11 01:00 2014/12/11 01:20  
> 2 2014/12/11 11:00 2014/12/11 01:10
> 
> In sql the query is simple:  
> select process\_id, max(log\_time), min(log\_time)  
> from logs\_table  
> group by process\_id
> 
> How can I run this query in Kibana? Is it possible to run the query in  
> "Discover" page or should I create a panel (Visualize page)?
> 
> thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bf13be11-d003-4038-925a-37331d55f9ae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bf13be11-d003-4038-925a-37331d55f9ae%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![RajeshAJ](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@RajeshAJ](https://discuss.elastic.co/u/RajeshAJ)\
**Post date:** [May 24, 2017, 6:18am UTC](https://discuss.elastic.co/t/run-a-simple-sql-group-by-query-in-kibana-4/21211/4 "2017-05-24T06:18:04Z")

</div>

I also want the solution for this  
any one knows the 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:** [July 5, 2017, 10:00pm UTC](https://discuss.elastic.co/t/run-a-simple-sql-group-by-query-in-kibana-4/21211/5 "2017-07-05T22:00:08Z")

</div>


