Elasticsearch error: Elasticsearch::Transport::Transport::Errors::Conflict: [409] version conflict
Seen in Sentry: https://sentry.gitlap.com/gitlab/gitlabcom/issues/40604/
Elasticsearch::Transport::Transport::Errors::Conflict: [409] {"took":14,"timed_out":false,"total":2,"deleted":1,"batches":1,"version_conflicts":1,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[{"index":"gitlab-production","type":"merge_request","id":"4592892","cause":{"type":"version_conflict_engine_exception","reason":"[merge_request][4592892]: version conflict, current version [18] is different than the one provided [14]","index_uuid":"i6oR9-cCTlWy3cYlxHw8DA","shard":"22","index":"gitlab-production"},"status":409}]}
from elasticsearch/transport/transport/base.rb:201:in `__raise_transport_error'
from elasticsearch/transport/transport/base.rb:318:in `perform_request'
from elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
from elasticsearch/transport/client.rb:131:in `perform_request'
from elasticsearch/api/actions/delete_by_query.rb:101:in `delete_by_query'
from app/workers/elastic_indexer_worker.rb:79:in `remove_children_documents'
from app/workers/elastic_indexer_worker.rb:63:in `clear_project_data'
from app/workers/elastic_indexer_worker.rb:40:in `perform'
from sidekiq/processor.rb:204:in `execute_job'
Line of code: app/workers/elastic_indexer_worker.rb in remove_children_documents at line 79
def remove_children_documents(document_type, parent_record_id) # here
client.delete_by_query({
index: Project.__elasticsearch__.index_name,
body: {
query: {
Edited by Nick Thomas