mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 22:45:04 +00:00
API Change: opType=create, closes #107
This commit is contained in:
parent
ff1fa9daad
commit
d0a79223db
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package org.elasticsearch.rest.action.index;
|
package org.elasticsearch.rest.action.index;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
import org.elasticsearch.action.index.IndexRequest;
|
||||||
@ -43,6 +44,14 @@ public class RestIndexAction extends BaseRestHandler {
|
|||||||
super(settings, client);
|
super(settings, client);
|
||||||
controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
|
controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
|
||||||
controller.registerHandler(PUT, "/{index}/{type}/{id}", this);
|
controller.registerHandler(PUT, "/{index}/{type}/{id}", this);
|
||||||
|
controller.registerHandler(PUT, "/{index}/{type}/{id}/_create", new CreateHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
final class CreateHandler implements RestHandler {
|
||||||
|
@Override public void handleRequest(RestRequest request, RestChannel channel) {
|
||||||
|
request.params().put("op_type", ImmutableList.of("create"));
|
||||||
|
RestIndexAction.this.handleRequest(request, channel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
|
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user