Skip to content

Commit d0a7922

Browse files
committed
API Change: opType=create, closes #107
1 parent ff1fa9d commit d0a7922

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.rest.action.index;
2121

22+
import com.google.common.collect.ImmutableList;
2223
import com.google.inject.Inject;
2324
import org.elasticsearch.action.ActionListener;
2425
import org.elasticsearch.action.index.IndexRequest;
@@ -43,6 +44,14 @@ public class RestIndexAction extends BaseRestHandler {
4344
super(settings, client);
4445
controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
4546
controller.registerHandler(PUT, "/{index}/{type}/{id}", this);
47+
controller.registerHandler(PUT, "/{index}/{type}/{id}/_create", new CreateHandler());
48+
}
49+
50+
final class CreateHandler implements RestHandler {
51+
@Override public void handleRequest(RestRequest request, RestChannel channel) {
52+
request.params().put("op_type", ImmutableList.of("create"));
53+
RestIndexAction.this.handleRequest(request, channel);
54+
}
4655
}
4756

4857
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {

0 commit comments

Comments
 (0)