Can't get sorting working on date and geo_location


(xrado) #1

this is my mapping
"test" : {
"properties" : {
"model" : {
"index" : "not_analyzed",
"type" : "string"
},
"expires" : {
"null_value" : "-1",
"format" : "yyyy-MM-dd HH:mm:ss",
"type" : "date"
},
"location" : {
"type" : "geo_point"
},
"subject" : {
"type" : "string"
},
"description" : {
"type" : "string"
},
"class" : {
"index" : "not_analyzed",
"type" : "string"
},
"date" : {
"format" : "yyyy-MM-dd HH:mm:ss",
"type" : "date"
},
"cid" : {
"index" : "not_analyzed",
"type" : "string"
},
"country" : {
"index" : "not_analyzed",
"type" : "string"
}
}
}

sorting by _id works, but by date and expired I get the same results with asc and desc,
same with _geo_distance sort on location

any idea what I'm doing wrong?


(Shay Banon) #2

gist a recreation.

On Wednesday, June 8, 2011 at 1:43 PM, xrado wrote:

this is my mapping
"test" : {
"properties" : {
"model" : {
"index" : "not_analyzed",
"type" : "string"
},
"expires" : {
"null_value" : "-1",
"format" : "yyyy-MM-dd HH:mm:ss",
"type" : "date"
},
"location" : {
"type" : "geo_point"
},
"subject" : {
"type" : "string"
},
"description" : {
"type" : "string"
},
"class" : {
"index" : "not_analyzed",
"type" : "string"
},
"date" : {
"format" : "yyyy-MM-dd HH:mm:ss",
"type" : "date"
},
"cid" : {
"index" : "not_analyzed",
"type" : "string"
},
"country" : {
"index" : "not_analyzed",
"type" : "string"
}
}
}

sorting by _id works, but by date and expired I get the same results with
asc and desc,
same with _geo_distance sort on location

any idea what I'm doing wrong?

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/can-t-get-sorting-working-on-date-and-geo-location-tp3038561p3038561.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com (http://Nabble.com).


(xrado) #3

date sorting https://gist.github.com/1014273

(geo_distance started working)


(Shay Banon) #4

Whats not working exactly in your gist? Things seem to work well for me, but you did not say what does not work... :slight_smile:

On Wednesday, June 8, 2011 at 2:48 PM, xrado wrote:

date sorting https://gist.github.com/1014273

(geo_distance started working)

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/can-t-get-sorting-working-on-date-and-geo-location-tp3038561p3038727.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com (http://Nabble.com).


(xrado) #5

try switching sorting order on date ("sort":{"date":"asc"}) or expires ( "sort":{"expires":"asc") asc/desc,
not sorting, returns the same result https://gist.github.com/1014273


(thnguyen) #6

Sorry just testing if I can reply to posts.


(Ludovic Levesque) #7

Hi,

I just tested on a 0.16.2 cluster, and for dates asc/desc, results are
the same, but it's normal, date values are the same in both docs
"2011-06-08 10:30:09", sort value: 1307529009000

For expires asc/desc, I have correct results, see
https://gist.github.com/1014273#comments and sort values: -1 and
1307701809000

Ludo

On Wed, Jun 8, 2011 at 8:15 PM, xrado radovan.lozej@gmail.com wrote:

try switching sorting order on date ("sort":{"date":"asc"}) or expires (
"sort":{"expires":"asc") asc/desc,
not sorting, returns the same result https://gist.github.com/1014273

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/can-t-get-sorting-working-on-date-and-geo-location-tp3038561p3040193.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(xrado) #8

i guess then is my messy data, need to look closer, thx to all for now


(fashionalwallet) #9
  • deleted -

(system) #10