Sort by doc _version descending

Apparently I can't sort a query by the _version number of a document so I
am attempting to duplicate the functionality.

I tried to do it with a script field sort (which fails)


"fields": "myfield",
"wildcard": {"value": "abc*"}
"sort" :
"_script" : {
"script" : "doc['_version'].value",
"type" : "number",
"order" : "desc"

Can anyone recommend a strategy for this? I would like to sort by the
number of times a document has been updated in descending order.


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
For more options, visit