Incrementing an integer field


(Frank LaRosa) #1

Hi,

Is there a more efficient way to increment an integer field besides
reading the entire document, updating the number, and re-indexing the
document?

Thanks,

Frank


This Discourse does not appear in Google?
(lukeforehand-2) #2

I believe you can do it with a script in the new release candidate:

http://www.elasticsearch.org/download/2012/02/07/0.19.0.RC1.html

specific issue:

-Luke

On Feb 8, 12:18 pm, Frank LaRosa fr...@studyblue.com wrote:

Hi,

Is there a more efficient way to increment an integer field besides
reading the entire document, updating the number, and re-indexing the
document?

Thanks,

Frank


(Frank LaRosa) #3

Thanks Luke. That looks extremely powerful indeed, if it works as
advertised.

I'm somewhat curious as to how the server actually executes the script
-- I'm guessing that since ES is based on Lucene, it still has to read
and rewrite the entire document to the index. However, not having to
pass the document over the network is still a substantial benefit.

Frank

On Feb 8, 12:58 pm, lukeforehand lukeforeh...@gmail.com wrote:

I believe you can do it with a script in the new release candidate:

http://www.elasticsearch.org/download/2012/02/07/0.19.0.RC1.html

specific issue:http://github.com/elasticsearch/elasticsearch/issues/1583

-Luke

On Feb 8, 12:18 pm, Frank LaRosa fr...@studyblue.com wrote:

Hi,

Is there a more efficient way to increment an integer field besides
reading the entire document, updating the number, and re-indexing the
document?

Thanks,

Frank


(Shay Banon) #4

Yea, the document still needs to be reindexed (I explicitly stated it at the issue and in the guide, just to make sure :slight_smile: ).

On Wednesday, February 8, 2012 at 10:45 PM, Frank LaRosa wrote:

Thanks Luke. That looks extremely powerful indeed, if it works as
advertised.

I'm somewhat curious as to how the server actually executes the script
-- I'm guessing that since ES is based on Lucene, it still has to read
and rewrite the entire document to the index. However, not having to
pass the document over the network is still a substantial benefit.

Frank

On Feb 8, 12:58 pm, lukeforehand <lukeforeh...@gmail.com (http://gmail.com)> wrote:

I believe you can do it with a script in the new release candidate:

http://www.elasticsearch.org/download/2012/02/07/0.19.0.RC1.html

specific issue:http://github.com/elasticsearch/elasticsearch/issues/1583

-Luke

On Feb 8, 12:18 pm, Frank LaRosa <fr...@studyblue.com (http://studyblue.com)> wrote:

Hi,

Is there a more efficient way to increment an integer field besides
reading the entire document, updating the number, and re-indexing the
document?

Thanks,

Frank


(system) #5