Sort by _version field


(Greg-2) #1

Hi,

i must sort the documents by the version number ("_version"- field).
How can I do that?

Thanks.

Greg


(Shay Banon) #2

There is no way to sort on the _version field. Why do you need it? Can you
explain the use case a bit?

On Wed, Jun 20, 2012 at 4:28 PM, Greg linuxzwerg@googlemail.com wrote:

Hi,

i must sort the documents by the version number ("_version"- field).
How can I do that?

Thanks.

Greg


(Greg-2) #3

Hi,

i want to create search term statistics. If new search occurs then i create
a document with id like a term. If document exists, version will increased.
And then i want to select 10 most searched terms.

Have you any idea how I could do it differently?

Thanks.
Greg

Am Donnerstag, 21. Juni 2012 09:27:47 UTC+2 schrieb kimchy:

There is no way to sort on the _version field. Why do you need it? Can you
explain the use case a bit?

On Wed, Jun 20, 2012 at 4:28 PM, Greg wrote:

Hi,

i must sort the documents by the version number ("_version"- field).
How can I do that?

Thanks.

Greg


(kevins) #4

I was looking for this same feature.

My use case is to return the documents that have been updated the most number of times.

It is used in a frequency algorithm that powers an autocomplete. (Yeah, another one of those).

When I index a document I will add certain words to the autocomplete type. If I can sort by _version:desc I will get back the most frequent words by default.

e.g.

type "in" autocompletes with

indiana (_version:4343)
indy (_version:1234)
inside (_version:432)
etc.


(Ivan Brusic) #5

The version field is not part of the document, but is stored in memory that
is updated in parallel with updating the document in Lucene. Since the
field is not part of the document, it is not indexed and thefore not
queryable or sortable.

Cheers,

Ivan

On Tue, Nov 12, 2013 at 4:28 PM, kevins kevinsteger@gmail.com wrote:

I was looking for this same feature.

My use case is to return the documents that have been updated the most
number of times.

It is used in a frequency algorithm that powers an autocomplete. (Yeah,
another one of those).

When I index a document I will add certain words to the autocomplete type.
If I can sort by _version:desc I will get back the most frequent words by
default.

e.g.

type "in" autocompletes with

indiana (_version:4343)
indy (_version:1234)
inside (_version:432)
etc.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Sort-by-version-field-tp4019525p4044170.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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.

--
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) #6