TimeStamp based sorting is not working in ES

Hi All,

I have a field timeStamp (which is not be confused _timestamp), where i
store date_time format date (yyyy-MM-dd'T'HH:mm:ss.SSSZ). I have pushed a
couple of documents with different timestamp.
http://localhost:9200/_search?Sort=timeStamp:desc&from=0&size=10

Tried to query it using above URI. But it seem to be not in sorted order as
expected.
mapping looks like below,

· "timeStamp": {

  • "type": "date",
  • *"format": "date_time" *

what i am looking for is to sort the timestamp value in desc/asc
format...is there anything wrong which i am trying? Thanks for the help.

-Prab

--

Hello,

I'm not sure how you can do it just with the URL, but this should work:

curl localhost:9200/_search?pretty=true -d '{"sort":{"timeStamp": "desc"}}'

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Mon, Dec 17, 2012 at 5:17 PM, Prab itsmeprabhakar@gmail.com wrote:

Hi All,

I have a field timeStamp (which is not be confused _timestamp), where i
store date_time format date (yyyy-MM-dd'T'HH:mm:ss.SSSZ). I have pushed a
couple of documents with different timestamp.
http://localhost:9200/_search?Sort=timeStamp:desc&from=0&size=10

Tried to query it using above URI. But it seem to be not in sorted order
as expected.
mapping looks like below,

· "timeStamp": {

  • "type": "date",
  • *"format": "date_time" *

what i am looking for is to sort the timestamp value in desc/asc
format...is there anything wrong which i am trying? Thanks for the help.

-Prab

--

--

Hi Radu,

Thanks for replying...it was an Usage error. I figured it out.
http://localhost:9200/_search?Sort=timeStamp:desc&from=0&size=10

S in sort should be lower case :smiley:

Thanks
Prab

On Monday, December 17, 2012 10:53:02 PM UTC+5:30, Radu Gheorghe wrote:

Hello,

I'm not sure how you can do it just with the URL, but this should work:

curl localhost:9200/_search?pretty=true -d '{"sort":{"timeStamp": "desc"}}'

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Mon, Dec 17, 2012 at 5:17 PM, Prab <itsmepr...@gmail.com <javascript:>>wrote:

Hi All,

I have a field timeStamp (which is not be confused _timestamp), where i
store date_time format date (yyyy-MM-dd'T'HH:mm:ss.SSSZ). I have pushed
a couple of documents with different timestamp.
http://localhost:9200/_search?Sort=timeStamp:desc&from=0&size=10

Tried to query it using above URI. But it seem to be not in sorted order
as expected.
mapping looks like below,

· "timeStamp": {

  • "type": "date",
  • *"format": "date_time" *

what i am looking for is to sort the timestamp value in desc/asc
format...is there anything wrong which i am trying? Thanks for the help.

-Prab

--

--