# Sorting with elasticsearch input

**URL:** <https://discuss.elastic.co/t/sorting-with-elasticsearch-input/61614>\
**Category:** Logstash\
**Created:** [September 27, 2016, 1:58pm UTC](https://discuss.elastic.co/t/sorting-with-elasticsearch-input/61614 "2016-09-27T13:58:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aviv.ratzon](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aviv.ratzon](https://discuss.elastic.co/u/aviv.ratzon)\
**Post date:** [September 27, 2016, 1:58pm UTC](https://discuss.elastic.co/t/sorting-with-elasticsearch-input/61614/1 "2016-09-27T13:58:48Z")

</div>

Hi everyone,  
I'm trying to use the elasticsearch input and the results are not as I excpect. I want the data to be inputed ordered by @timestamp. This is my configuration:

> input {
> 
> # Read all documents from Elasticsearch matching the given query
> 
> elasticsearch {  
> scan =\> false  
> hosts =\> "10.0.211.42:9200"  
> index =\> "logstash-\*-qc"  
> query =\> '{ "query": { "match": { "Status": "New" } },"sort": [{"@timestamp": {"order": "desc"}}] }'  
> }  
> }  
> output {  
> file  
> {  
> path =\> "C:/out.txt"  
> }  
> }

But still the output has no order... What can I do?

Thank you!

---

<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, 4:36am UTC](https://discuss.elastic.co/t/sorting-with-elasticsearch-input/61614/2 "2017-07-06T04:36:38Z")

</div>


