Sort by doc _version descending


(kevins) #1

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",
"query":
{
"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.

Thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2