From 43aabe88e85ead55ca14ca01b40137013e7c51ab Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 10 Jan 2013 14:25:44 +0100 Subject: [PATCH] Fixed document already exists error when concurrently sending update request with upsert using the same id. Closes #2530 --- .../org/elasticsearch/action/update/TransportUpdateAction.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java b/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java index 37470841098..2226d1c4ce3 100644 --- a/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java +++ b/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java @@ -52,6 +52,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.index.engine.DocumentAlreadyExistsException; import org.elasticsearch.index.engine.DocumentMissingException; import org.elasticsearch.index.engine.DocumentSourceMissingException; import org.elasticsearch.index.engine.VersionConflictEngineException; @@ -252,7 +253,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio @Override public void onFailure(Throwable e) { e = ExceptionsHelper.unwrapCause(e); - if (e instanceof VersionConflictEngineException) { + if (e instanceof VersionConflictEngineException || e instanceof DocumentAlreadyExistsException) { if (retryCount < request.retryOnConflict()) { threadPool.executor(executor()).execute(new Runnable() { @Override