# Sort query kibana (in the search window)

**URL:** https://discuss.elastic.co/t/sort-query-kibana-in-the-search-window/63809
**Category:** Kibana
**Created:** [October 24, 2016, 11:26pm UTC](https://discuss.elastic.co/t/sort-query-kibana-in-the-search-window/63809 "2016-10-24T23:26:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)
#### Post date: [October 24, 2016, 11:26pm UTC](https://discuss.elastic.co/t/sort-query-kibana-in-the-search-window/63809/1 "2016-10-24T23:26:16Z")

</div>

Is there a way to create a search query in kibana

I have multiple entries, and i want to return that last one.

Here's the query i ran in elasticsearch which returns the latest entry. I want to do that in kibana. I tried to use this query in the search bar of kibana, but i'm not sure if sort works. Or if maybe my syntax is not correct.

{  
"sort": [  
{ "chargeback.process\_date": "desc"}  
],  
"size": 1  
}

---

<div class="post-metadata">

### Author: ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)
#### Post date: [October 25, 2016, 6:45pm UTC](https://discuss.elastic.co/t/sort-query-kibana-in-the-search-window/63809/2 "2016-10-25T18:45:06Z")

</div>

The search bar in Kibana lets you enter a search `"query"` specifically, not the entire search request (which is what your example shows). In discover you can sort by a column in the table, and you can then put that table on the dashboard. Is this sufficient?

---

<div class="post-metadata">

### Author: ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)
#### Post date: [October 25, 2016, 9:26pm UTC](https://discuss.elastic.co/t/sort-query-kibana-in-the-search-window/63809/3 "2016-10-25T21:26:16Z")

</div>

I tried to use "query" but I get an error from kibana. I did the following command (below), this got me the results that i wanted, it return the latest value, but now the other dates won't show up if i drill down on them due to this search constraint.

{ "range" : { "chargeback.process\_date" : { "gte" : "now/d" }}}

Can you provide me with the "query" string example?

---

<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 6, 2017, 1:35pm UTC](https://discuss.elastic.co/t/sort-query-kibana-in-the-search-window/63809/4 "2017-07-06T13:35:40Z")

</div>


