Getting version_conflict_eng (409) while updating in the existing Index

934 views Asked by At

I am trying to update some data in an AWS Elastic Search Index,

I am trying to update using this method:

https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/updating_documents.html

Update Method:

$params = [
'index' => 'my_index',
'id'    => 'my_id',
'body'  => [
    'doc' => [
        'new_field' => 'abc'
    ]
];

$response = $client->update($params);

But I am getting the below mentioned error.

Error: 

    [728376]: version conflict,
    required seqNo [145274], 
    primary term [1]. 
    current document has seqNo [779385] and primary term [2]
    Status Code:  409
    Type: version_conflict_eng
    Index: user 

Index Mapping(JSON):

{"user":{"mappings":{"dynamic":"strict","properties":{"EMAIL":{"type":"text"},"FIRSTNAME":{"type":"text"},"MOBILE_NUMBER":{"type":"long"},"NOT_VISIBLE_IDS":{"type":"text"},"SOCIAL_CONTACT":{"type":"nested","include_in_parent":true,"properties":{"DEGREE":{"type":"long"},"FOLLOWER":{"type":"long"}}},"TOTAL_FOLLOWER":{"type":"long"},"USERID":{"type":"long"},"USERNAME":{"type":"text"},"USER_STRING_UNIQUE_ID":{"type":"text"}}}}}

Index Setting(JSON):

    {"user":{"settings":{"index":{"mapping":{"nested_objects":{"limit":"2000000"}},"number_of_shards":"5","provided_name":"user","creation_date":"1619021545916","number_of_replicas":"1","uuid":"PzyebOY9SIG-BXl-N9aW8Q","version":{"created":"7010199"}}}}}
1

There are 1 answers

3
Kaveh On

You get this error because you are trying to update a document that has newer version in your index, Elastic uses optimistic locking for version checking for more info about versioning support in ES check here.