Updating a document using Java API


(Neera Vats) #1

Hi All,

As part of an update request, I need to add new fields to a document(search
to get the doc-id and then update).

With Lucene API's it can be achieved by 1) reading the doc into a temp
document 2) update the temp document 3) delete the original document from
index and add the temp document.

How does update work in ES. It is also delete and add a new document?

My index has some un-stored fields. Is there a way to keep the un-stored
field after the update or they are lost in ElasticSearch?

Would appreciate any pointers you might have.

Thanks!

Neera

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/22b1bbd3-ce0b-49bf-9eb0-5e1b56edf159%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ivan Brusic) #2

Are you storing the document source? If so, you can use the update API. If
not, you would need to reindex from the original source.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.html

--
Ivan

On Tue, Jun 17, 2014 at 11:23 AM, ESUser neeravats@gmail.com wrote:

Hi All,

As part of an update request, I need to add new fields to a
document(search to get the doc-id and then update).

With Lucene API's it can be achieved by 1) reading the doc into a temp
document 2) update the temp document 3) delete the original document from
index and add the temp document.

How does update work in ES. It is also delete and add a new document?

My index has some un-stored fields. Is there a way to keep the un-stored
field after the update or they are lost in ElasticSearch?

Would appreciate any pointers you might have.

Thanks!

Neera

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/22b1bbd3-ce0b-49bf-9eb0-5e1b56edf159%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/22b1bbd3-ce0b-49bf-9eb0-5e1b56edf159%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAvNUt--knLV9f-yLV9JRuxxz7rgSiD_cygBZZzoEnptg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3