diff --git a/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/src/main/java/org/elasticsearch/action/index/IndexRequest.java index 2b7c27f26c6..2d13803ec20 100644 --- a/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -483,6 +483,15 @@ public class IndexRequest extends ShardReplicationOperationRequest return this; } + /** + * Sets a string representation of the {@link #opType(org.elasticsearch.action.index.IndexRequest.OpType)}. Can + * be either "index" or "create". + */ + public IndexRequest opType(String opType) throws ElasticsearchIllegalArgumentException { + return opType(OpType.fromString(opType)); + } + + /** * Set to true to force this index to use {@link OpType#CREATE}. */