Need help to update document fields in python


(PAULINE BONNEAU) #1

Hi all,

I'm new here and have a problem with a query in python. I hope someone can
help me ,please.

My problem is :

I have some documents in an index. I would like to update some document
fields in the index but I don't know how. If someone can help me, please
explain me how I can do that. I work in python with pyes.

If my problem is not clear, I can explain more.

Sorry if my writing in english is not very clear :slight_smile:

Paulyne

--
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/5688e05c-d4f0-4492-bc3f-c68d22a9d085%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Honza Král) #2

Hi Paulyne,

unfortunately with elasticsearch you need to update your documents
one-by-one using the Update API, I am not too familiar with pyes, but
it exposes the api as a method it seems:
http://pyes.readthedocs.org/en/latest/references/pyes.es.html?highlight=update#pyes.es.ES.update

alternatively you can just use the official python client that exposes
the api without any change from the curl:
http://elasticsearch-py.readthedocs.org/en/master/api.html#elasticsearch.Elasticsearch.update

Another alternative is just to index new version of the same document
(same index, type and id) using any api or tool you used in the first
place, that will overwrite the document in elasticsearch.

Hope this helps,
Honza

On Tue, Mar 18, 2014 at 4:40 PM, PAULINE BONNEAU
pauline.bonneau.33@gmail.com wrote:

Hi all,

I'm new here and have a problem with a query in python. I hope someone can
help me ,please.

My problem is :

I have some documents in an index. I would like to update some document
fields in the index but I don't know how. If someone can help me, please
explain me how I can do that. I work in python with pyes.

If my problem is not clear, I can explain more.

Sorry if my writing in english is not very clear :slight_smile:

Paulyne

--
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/5688e05c-d4f0-4492-bc3f-c68d22a9d085%40googlegroups.com.
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/CABfdDiqb1D4PFwYAZFdRoUw-Za5mu%2BgXZcTT1n4wp%3DoYnkj7Nw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(PAULINE BONNEAU) #3

Hi Honza,

Thanks for your help. I will try this now.

Paulyne

--
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/b27d5190-78b6-4ca6-9c04-ed230d14eecb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(PAULINE BONNEAU) #4

I'm sorry but I have just one more problem. I don't know what I must put in
the document parameter in the update function :

update(index, doc_type, id, script=None, lang='mvel',
params=None, document=None, upsert=None, model=None, bulk=False,
querystring_args=None, retry_on_conflict=None, routing=None,
doc_as_upsert=None)

I think this parameter permits me to update some fields of this document
but I don't know how to do that.
Thanks

Paulyne

--
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/dbe1e0f0-284e-4f95-912b-9ee30dd42105%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Honza Král) #5

The document you will put in will be merged with the document in
elasticsearch.

Honza
On Mar 18, 2014 6:06 PM, "PAULINE BONNEAU" pauline.bonneau.33@gmail.com
wrote:

I'm sorry but I have just one more problem. I don't know what I must put
in the document parameter in the update function :

update(index, doc_type, id, script=None, lang='mvel',
params=None, document=None, upsert=None, model=None, bulk=False,
querystring_args=None, retry_on_conflict=None, routing=None,
doc_as_upsert=None)

I think this parameter permits me to update some fields of this document
but I don't know how to do that.
Thanks

Paulyne

--
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/dbe1e0f0-284e-4f95-912b-9ee30dd42105%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/dbe1e0f0-284e-4f95-912b-9ee30dd42105%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/CABfdDioy9bzb--TmbGK1sMtV37uL9iWhc177LPjeJfEEfH5R1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6