SSG
SSG

Reputation: 1505

update by query performance in ElasticSearch

I am newbie to ElasticSearch . I am trying to update all the records using following inline script.

ES Version : 5.1.1
POST http://localhost:9200/index_1,index_2/type/_update_by_query?ignore_unavailable=true

{
    "script": {
        "inline": "if(ctx._source.containsKey(\"status\")){ctx._source.status.name = 'UPDATED_STATUS_NAME';ctx._source.status.value = 'UPDATED_STATUS_VALUE';ctx._source.status.name = 'UPDATED_STATUS_NAME';ctx._source.status.value = 'UPDATED_STATUS_VALUE';}"
    }
}

Now consider the following scenario:

1] we hit update by query on ES

2] step 1 is in progress and we get another update request

3] we hit update by query on ES again

4] Now 2 update queries are in progress

I want to know how ElasticSearch will behave in such condition

1] will there be conflicts ?

2] will ES be down since we are hitting update by query on thousand's of documents twice or may be the number of times user wants to perform update operation or rather any risk in above operation

Regards,
Sandeep

Upvotes: 0

Views: 1132

Answers (1)

sandeep rawat
sandeep rawat

Reputation: 4957

While updating if version conflict of document.

Processing depends on query param contain (?conflicts=proceed? )

1 Passed Will escape version conflicting document rest will get updated .

2 Not passed then document get updated until it get version conflict and operation get abort.

NOTE: In Neither of the case updated documents are not rolled back like RDBS.

Upvotes: 1

Related Questions