What is the name of a parameter "retry_on_conflict" in Bulk Update API


(Ilya Levin) #1

I'm performing a bulk update with parameter "retry_on_conflict".

In a documentation about Update API and Bulk Update and found a different naming of the same parameter.

https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-bulk.html#bulk-update
talking about "_retry_on_conflict"

https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-update.html#_parameters_2
requires "retry_on_conflict"

What should i use?

The code example:

type_of_document = "doc_type_AAA"
index_name = "index_AAA"
docid = "1234"
doc = {"a":1"}
full_doc = {"a":1, "time":time.time()}
doc = {
'_op_type': 'update',
"_index": index_name,
"_type": type_of_document,
"_id": docid,
"_routing": docid,
"doc": doc,
"upsert": full_doc,
"_retry_on_conflict": 3 # or "retry_on_conflict": 3 ?
}
helpers.streaming_bulk(es_client, [doc], chunk_size=500)


(Alexander Reelsen) #2

Hey,

the documentation contains the version, for which the documentation is valid - in your example it is 2.1 and 2.3. Always make sure the documentation matches with the elasticsearch version you are using.

In addition you are showing the documentation for the bulk API once and once for the update API. Again make sure you have the right docs for your API call. Yours looks like the update API.

--Alex


(Ilya Levin) #3

Agree about the version. I have fixed the initial post. The 2.3 says exactly the same as 2.1.

Yes, I'm pointed to 2 APIS that do exactly the same action on "version collision" but using the different parameter to configure it.

Very strange?


(Alexander Reelsen) #4

The bulk API is consistent with all of its metadata parameters being prefixed with an underscore (whether that underscore is needed is a different issue, but for now it is there, so thats why retry_on_conflict has it as well).


(Ilya Levin) #5

Thanks. I'll use as described in Bulk API.


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.