How does sorting on _id work?

... can it be that _id is treated as string? If so, is there any way
retrieve the max _id field with treating _id as integer?

Am Dienstag, 27. Januar 2015 19:24:41 UTC+1 schrieb Abid Hussain:

Hi all,

I want to determine the doc with max and min _id value. So, when I run
this query:
GET /my_index/order/_search
{
"fields": [ "_id" ],
"sort": [
{ "_uid": { "order": "desc" } }
],
"size": 1
}
I get a result:
{
...
"hits": {
...
"hits": [
{
"_index": "my_index",
"_type": "order",
"_id": "999999",
"_score": null,
"sort": [
"order#999999"
]
}
]
}
}

There is definitevely a doc with _id value 11132106 in index which I would
have expected as result.

And, when I run the same search with order asc I get a result with
_id 1000000 which is higher than 999999...?

What am I doing wrong?

Regards,

Abid

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d3e540ef-8e40-4f38-b655-db9da9b64946%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.