How can I update a single field of all the documents using java api in
elasticsearch?
There is no single field update in ES. To update a document, you have to
index the entire document again, hence to update a field for all documents,
you'd have to essentially index the entire data set. You'd be better off
creating a new index and take advantage of aliases to switch from the old
index to the new one.
Regards,
Berkay Mollamustafaoglu
mberkay on yahoo, google and skype
On Wed, Feb 22, 2012 at 12:07 AM, jajoria abhishek <
jajoria.abhishek@gmail.com> wrote:
How can I update a single field of all the documents using java api in
elasticsearch?
I want to increment or decrement an integer field like we do in sql can we
do that in ES.
How can we do that using java API?
On Wed, Feb 22, 2012 at 10:46 AM, Berkay Mollamustafaoglu <mberkay@gmail.com
wrote:
There is no single field update in ES. To update a document, you have to
index the entire document again, hence to update a field for all documents,
you'd have to essentially index the entire data set. You'd be better off
creating a new index and take advantage of aliases to switch from the old
index to the new one.Regards,
Berkay Mollamustafaoglu
mberkay on yahoo, google and skypeOn Wed, Feb 22, 2012 at 12:07 AM, jajoria abhishek <
jajoria.abhishek@gmail.com> wrote:How can I update a single field of all the documents using java api in
elasticsearch?
On Wed, 2012-02-22 at 11:16 +0530, jajoria abhishek wrote:
I want to increment or decrement an integer field like we do in sql
can we do that in ES.
How can we do that using java API?
In the 0.19* branch, there is the new update API. What this does for
you is to get the doc, run the script that you specify on the doc, then
reindex the doc.
It's the same thing that you'd have to do now, but a little faster
because it all happens on the server, without having to send the doc
between client and server.
However, the update API only works on a single doc, at least for now.
Shay has talked about adding an update_by_query API, but that is
considerably more complex.
So for the moment, there is no easy way to do the equivalent of:
UPDATE table SET foo = foo + 1
You are limited to updating/reindexing each doc individually
clint
You may want to look into counters in Cassandra. Depending on what you're
doing, it might be a good fit. My project is going to end up using ES for
some things, Cassandra for others.
-nate
"The sky calls to us. If we do not destroy ourselves, we will one day
venture to the stars." -- Carl Sagan
On Tue, Feb 21, 2012 at 10:46 PM, jajoria abhishek <
jajoria.abhishek@gmail.com> wrote:
I want to increment or decrement an integer field like we do in sql can
we do that in ES.How can we do that using java API?
On Wed, Feb 22, 2012 at 10:46 AM, Berkay Mollamustafaoglu <
mberkay@gmail.com> wrote:There is no single field update in ES. To update a document, you have to
index the entire document again, hence to update a field for all documents,
you'd have to essentially index the entire data set. You'd be better off
creating a new index and take advantage of aliases to switch from the old
index to the new one.Regards,
Berkay Mollamustafaoglu
mberkay on yahoo, google and skypeOn Wed, Feb 22, 2012 at 12:07 AM, jajoria abhishek <
jajoria.abhishek@gmail.com> wrote:How can I update a single field of all the documents using java api in
elasticsearch?