# Problem with sort

**URL:** <https://discuss.elastic.co/t/problem-with-sort/10809>\
**Category:** Elasticsearch\
**Created:** [February 19, 2013, 10:15pm UTC](https://discuss.elastic.co/t/problem-with-sort/10809 "2013-02-19T22:15:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastray](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@elastray](https://discuss.elastic.co/u/elastray)\
**Post date:** [February 19, 2013, 10:15pm UTC](https://discuss.elastic.co/t/problem-with-sort/10809/1 "2013-02-19T22:15:42Z")

</div>

It is a little bit weird, when I add sort to my query, I get a  
SearchParserException (JsonParseException) "'{' (code 123)): was expecting  
either valid name character (for unquoted name) or double-quote (for  
quoted) to start field name"

{

"from" : 0,

"size" : 20,

"sort" : {

{ "\_score" : {"order" : "desc"} }

},

"query":{

"query\_string" : {

"query" : "myquery"

}

}

}

without the "sort" part it works fine. I am using ES 0.19.4, may it be a  
version problem?

Thanks!!

--

* * *

## [http://www.xtivia.com](http://www.xtivia.com)[http://www.Virtual-DBA.com](http://www.Virtual-DBA.com)[http://www.Virtual-ASA.com](http://www.Virtual-ASA.com) [http://www.facebook.com/Xtivia](http://www.facebook.com/Xtivia)[http://twitter.com/#!/xtivia](http://twitter.com/#!/xtivia)[http://www.linkedin.com/company/xtivia](http://www.linkedin.com/company/xtivia) _Xtivia Virtual-Services (DBA/ASA) Customer Support: (800) 205-7537_

This e-mail may contain confidential or privileged information. If you  
believe you have received this e-mail in error, please notify the sender by  
reply e-mail and then delete this e-mail immediately.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [February 19, 2013, 10:24pm UTC](https://discuss.elastic.co/t/problem-with-sort/10809/2 "2013-02-19T22:24:13Z")

</div>

Did you try:

{

"from" : 0,

"size" : 20,

"sort" : {  
"\_score" : {"order" : "desc"}

},

"query":{

"query\_string" : {

"query" : "myquery"

}

}

}

On Tue, Feb 19, 2013 at 2:15 PM, elastray [adelpozo@xtivia.com](mailto:adelpozo@xtivia.com) wrote:

> It is a little bit weird, when I add sort to my query, I get a  
> SearchParserException (JsonParseException) "'{' (code 123)): was expecting  
> either valid name character (for unquoted name) or double-quote (for  
> quoted) to start field name"
> 
> {
> 
> "from" : 0,
> 
> "size" : 20,
> 
> "sort" : {
> 
> { "\_score" : {"order" : "desc"} }
> 
> },
> 
> "query":{
> 
> "query\_string" : {
> 
> "query" : "myquery"
> 
> }
> 
> }
> 
> }
> 
> without the "sort" part it works fine. I am using ES 0.19.4, may it be a  
> version problem?
> 
> Thanks!!
> 
> * * *
> 
> ## [http://www.xtivia.com](http://www.xtivia.com)[http://www.Virtual-DBA.com](http://www.Virtual-DBA.com)[http://www.Virtual-ASA.com](http://www.Virtual-ASA.com) [http://www.facebook.com/Xtivia](http://www.facebook.com/Xtivia)[http://twitter.com/#!/xtivia](http://twitter.com/#!/xtivia)[http://www.linkedin.com/company/xtivia](http://www.linkedin.com/company/xtivia) _Xtivia Virtual-Services (DBA/ASA) Customer Support: (800) 205-7537_
> 
> This e-mail may contain confidential or privileged information. If you  
> believe you have received this e-mail in error, please notify the sender by  
> reply e-mail and then delete this e-mail immediately.
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:50am UTC](https://discuss.elastic.co/t/problem-with-sort/10809/3 "2017-07-06T02:50:38Z")

</div>


