From 80ca78479f5046f58374ed831f6b2c3d51f530f9 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Mon, 22 Aug 2016 13:08:49 -0400 Subject: Make bulk item-level requests implement DocumentRequest interface Currently, bulk item requests can be any ActionRequest, this commit restricts bulk item requests to DocumentRequest. This simplifies handling failures during bulk requests. Additionally, a new enum is added to DocumentRequest to represent the intended operation to be performed by a document request. Now, index operation type also uses the new enum to specify whether the request should create or index a document. --- .../java/org/elasticsearch/rest/action/document/RestIndexAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/src/main/java/org/elasticsearch/rest/action/document') diff --git a/core/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java index 6c9723b5b9..f28a98f488 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java @@ -86,7 +86,7 @@ public class RestIndexAction extends BaseRestHandler { String sOpType = request.param("op_type"); if (sOpType != null) { try { - indexRequest.opType(IndexRequest.OpType.fromString(sOpType)); + indexRequest.opType(sOpType); } catch (IllegalArgumentException eia){ try { XContentBuilder builder = channel.newErrorBuilder(); -- cgit v1.2.3