explicitly set listener to false when applicable
This commit is contained in:
parent
98d2e7c031
commit
a0d1b9b695
|
@ -127,6 +127,12 @@ public class ClusterStateRequest extends MasterNodeOperationRequest {
|
||||||
return this.local;
|
return this.local;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClusterStateRequest listenerThreaded(boolean listenerThreaded) {
|
||||||
|
super.listenerThreaded(listenerThreaded);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
super.readFrom(in);
|
||||||
|
|
|
@ -87,6 +87,8 @@ public class TransportSearchScrollAction extends TransportAction<SearchScrollReq
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageReceived(SearchScrollRequest request, final TransportChannel channel) throws Exception {
|
public void messageReceived(SearchScrollRequest request, final TransportChannel channel) throws Exception {
|
||||||
|
// no need for a threaded listener
|
||||||
|
request.listenerThreaded(false);
|
||||||
execute(request, new ActionListener<SearchResponse>() {
|
execute(request, new ActionListener<SearchResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(SearchResponse result) {
|
public void onResponse(SearchResponse result) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class RestClusterHealthAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(RestActions.splitIndices(request.param("index")));
|
ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(RestActions.splitIndices(request.param("index")));
|
||||||
|
clusterHealthRequest.listenerThreaded(false);
|
||||||
int level = 0;
|
int level = 0;
|
||||||
try {
|
try {
|
||||||
clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));
|
clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class RestClusterRerouteAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
final ClusterRerouteRequest clusterRerouteRequest = Requests.clusterRerouteRequest();
|
final ClusterRerouteRequest clusterRerouteRequest = Requests.clusterRerouteRequest();
|
||||||
|
clusterRerouteRequest.listenerThreaded(false);
|
||||||
client.admin().cluster().reroute(clusterRerouteRequest, new ActionListener<ClusterRerouteResponse>() {
|
client.admin().cluster().reroute(clusterRerouteRequest, new ActionListener<ClusterRerouteResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(ClusterRerouteResponse response) {
|
public void onResponse(ClusterRerouteResponse response) {
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class RestClusterGetSettingsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
|
ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
|
||||||
|
.listenerThreaded(false)
|
||||||
.filterRoutingTable(true)
|
.filterRoutingTable(true)
|
||||||
.filterNodes(true);
|
.filterNodes(true);
|
||||||
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest();
|
final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest();
|
||||||
|
clusterUpdateSettingsRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
XContentType xContentType = XContentFactory.xContentType(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength());
|
XContentType xContentType = XContentFactory.xContentType(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength());
|
||||||
Map<String, Object> source = XContentFactory.xContent(xContentType)
|
Map<String, Object> source = XContentFactory.xContent(xContentType)
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class RestClusterStateAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest();
|
||||||
|
clusterStateRequest.listenerThreaded(false);
|
||||||
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
|
||||||
clusterStateRequest.filterNodes(request.paramAsBoolean("filter_nodes", clusterStateRequest.filterNodes()));
|
clusterStateRequest.filterNodes(request.paramAsBoolean("filter_nodes", clusterStateRequest.filterNodes()));
|
||||||
clusterStateRequest.filterRoutingTable(request.paramAsBoolean("filter_routing_table", clusterStateRequest.filterRoutingTable()));
|
clusterStateRequest.filterRoutingTable(request.paramAsBoolean("filter_routing_table", clusterStateRequest.filterRoutingTable()));
|
||||||
|
|
|
@ -61,6 +61,8 @@ public class RestGetIndicesAliasesAction extends BaseRestHandler {
|
||||||
.filterNodes(true)
|
.filterNodes(true)
|
||||||
.filteredIndices(indices);
|
.filteredIndices(indices);
|
||||||
|
|
||||||
|
clusterStateRequest.listenerThreaded(false);
|
||||||
|
|
||||||
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(ClusterStateResponse response) {
|
public void onResponse(ClusterStateResponse response) {
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class RestIndicesAliasesAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
||||||
|
indicesAliasesRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
// {
|
// {
|
||||||
// actions : [
|
// actions : [
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class RestAnalyzeAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"), text);
|
AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"), text);
|
||||||
|
analyzeRequest.listenerThreaded(false);
|
||||||
analyzeRequest.preferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.preferLocalShard()));
|
analyzeRequest.preferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.preferLocalShard()));
|
||||||
analyzeRequest.analyzer(request.param("analyzer"));
|
analyzeRequest.analyzer(request.param("analyzer"));
|
||||||
analyzeRequest.field(request.param("field"));
|
analyzeRequest.field(request.param("field"));
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index")));
|
ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index")));
|
||||||
|
clearIndicesCacheRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache()));
|
clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache()));
|
||||||
clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache()));
|
clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache()));
|
||||||
|
@ -64,8 +65,6 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
|
||||||
clearIndicesCacheRequest.bloomCache(request.paramAsBoolean("bloom", clearIndicesCacheRequest.bloomCache()));
|
clearIndicesCacheRequest.bloomCache(request.paramAsBoolean("bloom", clearIndicesCacheRequest.bloomCache()));
|
||||||
clearIndicesCacheRequest.fields(request.paramAsStringArray("fields", clearIndicesCacheRequest.fields()));
|
clearIndicesCacheRequest.fields(request.paramAsStringArray("fields", clearIndicesCacheRequest.fields()));
|
||||||
|
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
clearIndicesCacheRequest.listenerThreaded(false);
|
|
||||||
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD);
|
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD);
|
||||||
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
||||||
// since we don't spawn, don't allow no_threads, but change it to a single thread
|
// since we don't spawn, don't allow no_threads, but change it to a single thread
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class RestCloseIndexAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(request.param("index"));
|
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(request.param("index"));
|
||||||
|
closeIndexRequest.listenerThreaded(false);
|
||||||
closeIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
closeIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
||||||
client.admin().indices().close(closeIndexRequest, new ActionListener<CloseIndexResponse>() {
|
client.admin().indices().close(closeIndexRequest, new ActionListener<CloseIndexResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class RestCreateIndexAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index"));
|
CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index"));
|
||||||
|
createIndexRequest.listenerThreaded(false);
|
||||||
if (request.hasContent()) {
|
if (request.hasContent()) {
|
||||||
try {
|
try {
|
||||||
createIndexRequest.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength());
|
createIndexRequest.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength());
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class RestDeleteIndexAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(splitIndices(request.param("index")));
|
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(splitIndices(request.param("index")));
|
||||||
|
deleteIndexRequest.listenerThreaded(false);
|
||||||
deleteIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
deleteIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
||||||
client.admin().indices().delete(deleteIndexRequest, new ActionListener<DeleteIndexResponse>() {
|
client.admin().indices().delete(deleteIndexRequest, new ActionListener<DeleteIndexResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,7 +29,8 @@ import org.elasticsearch.common.settings.SettingsFilter;
|
||||||
import org.elasticsearch.rest.*;
|
import org.elasticsearch.rest.*;
|
||||||
|
|
||||||
import static org.elasticsearch.rest.RestRequest.Method.HEAD;
|
import static org.elasticsearch.rest.RestRequest.Method.HEAD;
|
||||||
import static org.elasticsearch.rest.RestStatus.*;
|
import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
||||||
|
import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
import static org.elasticsearch.rest.action.support.RestActions.splitIndices;
|
import static org.elasticsearch.rest.action.support.RestActions.splitIndices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +52,6 @@ public class RestIndicesExistsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesExistsRequest indicesExistsRequest = new IndicesExistsRequest(splitIndices(request.param("index")));
|
IndicesExistsRequest indicesExistsRequest = new IndicesExistsRequest(splitIndices(request.param("index")));
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
indicesExistsRequest.listenerThreaded(false);
|
indicesExistsRequest.listenerThreaded(false);
|
||||||
client.admin().indices().exists(indicesExistsRequest, new ActionListener<IndicesExistsResponse>() {
|
client.admin().indices().exists(indicesExistsRequest, new ActionListener<IndicesExistsResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class RestFlushAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
FlushRequest flushRequest = new FlushRequest(RestActions.splitIndices(request.param("index")));
|
FlushRequest flushRequest = new FlushRequest(RestActions.splitIndices(request.param("index")));
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
flushRequest.listenerThreaded(false);
|
flushRequest.listenerThreaded(false);
|
||||||
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD);
|
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD);
|
||||||
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class RestDeleteMappingAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
DeleteMappingRequest deleteMappingRequest = deleteMappingRequest(splitIndices(request.param("index")));
|
DeleteMappingRequest deleteMappingRequest = deleteMappingRequest(splitIndices(request.param("index")));
|
||||||
|
deleteMappingRequest.listenerThreaded(false);
|
||||||
deleteMappingRequest.type(request.param("type"));
|
deleteMappingRequest.type(request.param("type"));
|
||||||
client.admin().indices().deleteMapping(deleteMappingRequest, new ActionListener<DeleteMappingResponse>() {
|
client.admin().indices().deleteMapping(deleteMappingRequest, new ActionListener<DeleteMappingResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,6 +69,8 @@ public class RestGetMappingAction extends BaseRestHandler {
|
||||||
.filterNodes(true)
|
.filterNodes(true)
|
||||||
.filteredIndices(indices);
|
.filteredIndices(indices);
|
||||||
|
|
||||||
|
clusterStateRequest.listenerThreaded(false);
|
||||||
|
|
||||||
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(ClusterStateResponse response) {
|
public void onResponse(ClusterStateResponse response) {
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class RestPutMappingAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
PutMappingRequest putMappingRequest = putMappingRequest(splitIndices(request.param("index")));
|
PutMappingRequest putMappingRequest = putMappingRequest(splitIndices(request.param("index")));
|
||||||
|
putMappingRequest.listenerThreaded(false);
|
||||||
putMappingRequest.type(request.param("type"));
|
putMappingRequest.type(request.param("type"));
|
||||||
putMappingRequest.source(request.contentAsString());
|
putMappingRequest.source(request.contentAsString());
|
||||||
putMappingRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
putMappingRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class RestOpenIndexAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
OpenIndexRequest openIndexRequest = new OpenIndexRequest(request.param("index"));
|
OpenIndexRequest openIndexRequest = new OpenIndexRequest(request.param("index"));
|
||||||
|
openIndexRequest.listenerThreaded(false);
|
||||||
openIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
openIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
||||||
client.admin().indices().open(openIndexRequest, new ActionListener<OpenIndexResponse>() {
|
client.admin().indices().open(openIndexRequest, new ActionListener<OpenIndexResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class RestOptimizeAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
OptimizeRequest optimizeRequest = new OptimizeRequest(RestActions.splitIndices(request.param("index")));
|
OptimizeRequest optimizeRequest = new OptimizeRequest(RestActions.splitIndices(request.param("index")));
|
||||||
|
optimizeRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
optimizeRequest.waitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.waitForMerge()));
|
optimizeRequest.waitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.waitForMerge()));
|
||||||
optimizeRequest.maxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.maxNumSegments()));
|
optimizeRequest.maxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.maxNumSegments()));
|
||||||
|
@ -64,8 +65,6 @@ public class RestOptimizeAction extends BaseRestHandler {
|
||||||
optimizeRequest.flush(request.paramAsBoolean("flush", optimizeRequest.flush()));
|
optimizeRequest.flush(request.paramAsBoolean("flush", optimizeRequest.flush()));
|
||||||
optimizeRequest.refresh(request.paramAsBoolean("refresh", optimizeRequest.refresh()));
|
optimizeRequest.refresh(request.paramAsBoolean("refresh", optimizeRequest.refresh()));
|
||||||
|
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
optimizeRequest.listenerThreaded(false);
|
|
||||||
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
||||||
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
||||||
// since we don't spawn, don't allow no_threads, but change it to a single thread
|
// since we don't spawn, don't allow no_threads, but change it to a single thread
|
||||||
|
|
|
@ -56,7 +56,6 @@ public class RestRefreshAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
RefreshRequest refreshRequest = new RefreshRequest(RestActions.splitIndices(request.param("index")));
|
RefreshRequest refreshRequest = new RefreshRequest(RestActions.splitIndices(request.param("index")));
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
refreshRequest.listenerThreaded(false);
|
refreshRequest.listenerThreaded(false);
|
||||||
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
||||||
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class RestIndicesSegmentsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(splitIndices(request.param("index")));
|
IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(splitIndices(request.param("index")));
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
indicesSegmentsRequest.listenerThreaded(false);
|
indicesSegmentsRequest.listenerThreaded(false);
|
||||||
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
||||||
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
if (operationThreading == BroadcastOperationThreading.NO_THREADS) {
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
||||||
.filterRoutingTable(true)
|
.filterRoutingTable(true)
|
||||||
.filterNodes(true)
|
.filterNodes(true)
|
||||||
.filteredIndices(indices);
|
.filteredIndices(indices);
|
||||||
|
clusterStateRequest.listenerThreaded(false);
|
||||||
|
|
||||||
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,6 +55,8 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(splitIndices(request.param("index")));
|
UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(splitIndices(request.param("index")));
|
||||||
|
updateSettingsRequest.listenerThreaded(false);
|
||||||
|
|
||||||
ImmutableSettings.Builder updateSettings = ImmutableSettings.settingsBuilder();
|
ImmutableSettings.Builder updateSettings = ImmutableSettings.settingsBuilder();
|
||||||
String bodySettings = request.contentAsString();
|
String bodySettings = request.contentAsString();
|
||||||
if (Strings.hasText(bodySettings)) {
|
if (Strings.hasText(bodySettings)) {
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
boolean clear = request.paramAsBoolean("clear", false);
|
boolean clear = request.paramAsBoolean("clear", false);
|
||||||
if (clear) {
|
if (clear) {
|
||||||
indicesStatsRequest.clear();
|
indicesStatsRequest.clear();
|
||||||
|
@ -136,6 +137,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().docs(true);
|
indicesStatsRequest.clear().docs(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||||
|
@ -173,6 +175,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().store(true);
|
indicesStatsRequest.clear().store(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||||
|
@ -210,6 +213,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().indexing(true);
|
indicesStatsRequest.clear().indexing(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
if (request.hasParam("types")) {
|
if (request.hasParam("types")) {
|
||||||
|
@ -253,6 +257,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().search(true);
|
indicesStatsRequest.clear().search(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
if (request.hasParam("groups")) {
|
if (request.hasParam("groups")) {
|
||||||
|
@ -296,6 +301,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().get(true);
|
indicesStatsRequest.clear().get(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
|
|
||||||
|
@ -332,6 +338,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().merge(true);
|
indicesStatsRequest.clear().merge(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||||
|
@ -369,6 +376,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().flush(true);
|
indicesStatsRequest.clear().flush(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||||
|
@ -406,6 +414,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().warmer(true);
|
indicesStatsRequest.clear().warmer(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||||
|
@ -443,6 +452,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||||
|
indicesStatsRequest.listenerThreaded(false);
|
||||||
indicesStatsRequest.clear().refresh(true);
|
indicesStatsRequest.clear().refresh(true);
|
||||||
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
indicesStatsRequest.indices(splitIndices(request.param("index")));
|
||||||
indicesStatsRequest.types(splitTypes(request.param("types")));
|
indicesStatsRequest.types(splitTypes(request.param("types")));
|
||||||
|
|
|
@ -58,7 +58,6 @@ public class RestIndicesStatusAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndicesStatusRequest indicesStatusRequest = new IndicesStatusRequest(splitIndices(request.param("index")));
|
IndicesStatusRequest indicesStatusRequest = new IndicesStatusRequest(splitIndices(request.param("index")));
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
indicesStatusRequest.listenerThreaded(false);
|
indicesStatusRequest.listenerThreaded(false);
|
||||||
indicesStatusRequest.recovery(request.paramAsBoolean("recovery", indicesStatusRequest.recovery()));
|
indicesStatusRequest.recovery(request.paramAsBoolean("recovery", indicesStatusRequest.recovery()));
|
||||||
indicesStatusRequest.snapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.snapshot()));
|
indicesStatusRequest.snapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.snapshot()));
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name"));
|
DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name"));
|
||||||
|
deleteIndexTemplateRequest.listenerThreaded(false);
|
||||||
deleteIndexTemplateRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
deleteIndexTemplateRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
|
||||||
client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new ActionListener<DeleteIndexTemplateResponse>() {
|
client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new ActionListener<DeleteIndexTemplateResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -66,6 +66,8 @@ public class RestGetIndexTemplateAction extends BaseRestHandler {
|
||||||
.filteredIndexTemplates(request.param("name"))
|
.filteredIndexTemplates(request.param("name"))
|
||||||
.filteredIndices("_na");
|
.filteredIndices("_na");
|
||||||
|
|
||||||
|
clusterStateRequest.listenerThreaded(false);
|
||||||
|
|
||||||
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(ClusterStateResponse response) {
|
public void onResponse(ClusterStateResponse response) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class RestPutIndexTemplateAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
|
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
|
||||||
|
putRequest.listenerThreaded(false);
|
||||||
putRequest.template(request.param("template", putRequest.template()));
|
putRequest.template(request.param("template", putRequest.template()));
|
||||||
putRequest.order(request.paramAsInt("order", putRequest.order()));
|
putRequest.order(request.paramAsInt("order", putRequest.order()));
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(RestActions.splitIndices(request.param("index")));
|
ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(RestActions.splitIndices(request.param("index")));
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
validateQueryRequest.listenerThreaded(false);
|
validateQueryRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
||||||
|
@ -109,7 +108,7 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
||||||
|
|
||||||
buildBroadcastShardsHeader(builder, response);
|
buildBroadcastShardsHeader(builder, response);
|
||||||
|
|
||||||
if(response.queryExplanations() != null && !response.queryExplanations().isEmpty()) {
|
if (response.queryExplanations() != null && !response.queryExplanations().isEmpty()) {
|
||||||
builder.startArray("explanations");
|
builder.startArray("explanations");
|
||||||
for (QueryExplanation explanation : response.queryExplanations()) {
|
for (QueryExplanation explanation : response.queryExplanations()) {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class RestDeleteWarmerAction extends BaseRestHandler {
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
DeleteWarmerRequest deleteWarmerRequest = new DeleteWarmerRequest(request.param("name"))
|
DeleteWarmerRequest deleteWarmerRequest = new DeleteWarmerRequest(request.param("name"))
|
||||||
.indices(RestActions.splitIndices(request.param("index")));
|
.indices(RestActions.splitIndices(request.param("index")));
|
||||||
|
deleteWarmerRequest.listenerThreaded(false);
|
||||||
client.admin().indices().deleteWarmer(deleteWarmerRequest, new ActionListener<DeleteWarmerResponse>() {
|
client.admin().indices().deleteWarmer(deleteWarmerRequest, new ActionListener<DeleteWarmerResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(DeleteWarmerResponse response) {
|
public void onResponse(DeleteWarmerResponse response) {
|
||||||
|
|
|
@ -67,6 +67,8 @@ public class RestGetWarmerAction extends BaseRestHandler {
|
||||||
.filterMetaData(false)
|
.filterMetaData(false)
|
||||||
.filteredIndices(indices);
|
.filteredIndices(indices);
|
||||||
|
|
||||||
|
clusterStateRequest.listenerThreaded(false);
|
||||||
|
|
||||||
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
client.admin().cluster().state(clusterStateRequest, new ActionListener<ClusterStateResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(ClusterStateResponse response) {
|
public void onResponse(ClusterStateResponse response) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class RestPutWarmerAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
PutWarmerRequest putWarmerRequest = new PutWarmerRequest(request.param("name"));
|
PutWarmerRequest putWarmerRequest = new PutWarmerRequest(request.param("name"));
|
||||||
|
putWarmerRequest.listenerThreaded(false);
|
||||||
SearchRequest searchRequest = new SearchRequest(RestActions.splitIndices(request.param("index")))
|
SearchRequest searchRequest = new SearchRequest(RestActions.splitIndices(request.param("index")))
|
||||||
.types(RestActions.splitTypes(request.param("type")))
|
.types(RestActions.splitTypes(request.param("type")))
|
||||||
.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength(), request.contentUnsafe());
|
.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength(), request.contentUnsafe());
|
||||||
|
|
|
@ -50,8 +50,6 @@ import static org.elasticsearch.rest.action.support.RestXContentBuilder.restCont
|
||||||
* { "create" : { "_index" : "test", "_type" : "type1", "_id" : "1" }
|
* { "create" : { "_index" : "test", "_type" : "type1", "_id" : "1" }
|
||||||
* { "type1" : { "field1" : "value1" } }
|
* { "type1" : { "field1" : "value1" } }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class RestBulkAction extends BaseRestHandler {
|
public class RestBulkAction extends BaseRestHandler {
|
||||||
|
|
||||||
|
@ -70,6 +68,7 @@ public class RestBulkAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
BulkRequest bulkRequest = Requests.bulkRequest();
|
BulkRequest bulkRequest = Requests.bulkRequest();
|
||||||
|
bulkRequest.listenerThreaded(false);
|
||||||
String defaultIndex = request.param("index");
|
String defaultIndex = request.param("index");
|
||||||
String defaultType = request.param("type");
|
String defaultType = request.param("type");
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class RestCountAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
CountRequest countRequest = new CountRequest(RestActions.splitIndices(request.param("index")));
|
CountRequest countRequest = new CountRequest(RestActions.splitIndices(request.param("index")));
|
||||||
// we just send back a response, no need to fork a listener
|
|
||||||
countRequest.listenerThreaded(false);
|
countRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD);
|
||||||
|
|
|
@ -54,15 +54,15 @@ public class RestDeleteAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
DeleteRequest deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id"));
|
DeleteRequest deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
|
|
||||||
|
deleteRequest.listenerThreaded(false);
|
||||||
|
deleteRequest.operationThreaded(true);
|
||||||
|
|
||||||
deleteRequest.parent(request.param("parent"));
|
deleteRequest.parent(request.param("parent"));
|
||||||
deleteRequest.routing(request.param("routing"));
|
deleteRequest.routing(request.param("routing"));
|
||||||
deleteRequest.timeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT));
|
deleteRequest.timeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT));
|
||||||
deleteRequest.refresh(request.paramAsBoolean("refresh", deleteRequest.refresh()));
|
deleteRequest.refresh(request.paramAsBoolean("refresh", deleteRequest.refresh()));
|
||||||
deleteRequest.version(RestActions.parseVersion(request));
|
deleteRequest.version(RestActions.parseVersion(request));
|
||||||
// we just send a response, no need to fork
|
|
||||||
deleteRequest.listenerThreaded(false);
|
|
||||||
// we don't spawn, then fork if local
|
|
||||||
deleteRequest.operationThreaded(true);
|
|
||||||
deleteRequest.versionType(VersionType.fromString(request.param("version_type"), deleteRequest.versionType()));
|
deleteRequest.versionType(VersionType.fromString(request.param("version_type"), deleteRequest.versionType()));
|
||||||
|
|
||||||
String replicationType = request.param("replication");
|
String replicationType = request.param("replication");
|
||||||
|
|
|
@ -58,7 +58,6 @@ public class RestDeleteByQueryAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(splitIndices(request.param("index")));
|
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(splitIndices(request.param("index")));
|
||||||
// we just build a response and send it, no need to fork a thread
|
|
||||||
deleteByQueryRequest.listenerThreaded(false);
|
deleteByQueryRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
if (request.hasContent()) {
|
if (request.hasContent()) {
|
||||||
|
|
|
@ -50,9 +50,7 @@ public class RestGetAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
|
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
// no need to have a threaded listener since we just send back a response
|
|
||||||
getRequest.listenerThreaded(false);
|
getRequest.listenerThreaded(false);
|
||||||
// if we have a local operation, execute it on a thread since we don't spawn
|
|
||||||
getRequest.operationThreaded(true);
|
getRequest.operationThreaded(true);
|
||||||
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
||||||
getRequest.parent(request.param("parent"));
|
getRequest.parent(request.param("parent"));
|
||||||
|
|
|
@ -66,6 +66,8 @@ public class RestIndexAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
IndexRequest indexRequest = new IndexRequest(request.param("index"), request.param("type"), request.param("id"));
|
IndexRequest indexRequest = new IndexRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
|
indexRequest.listenerThreaded(false);
|
||||||
|
indexRequest.operationThreaded(true);
|
||||||
indexRequest.routing(request.param("routing"));
|
indexRequest.routing(request.param("routing"));
|
||||||
indexRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
indexRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
||||||
indexRequest.timestamp(request.param("timestamp"));
|
indexRequest.timestamp(request.param("timestamp"));
|
||||||
|
@ -102,10 +104,6 @@ public class RestIndexAction extends BaseRestHandler {
|
||||||
if (consistencyLevel != null) {
|
if (consistencyLevel != null) {
|
||||||
indexRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel));
|
indexRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel));
|
||||||
}
|
}
|
||||||
// we just send a response, no need to fork
|
|
||||||
indexRequest.listenerThreaded(false);
|
|
||||||
// we don't spawn, then fork if local
|
|
||||||
indexRequest.operationThreaded(true);
|
|
||||||
client.index(indexRequest, new ActionListener<IndexResponse>() {
|
client.index(indexRequest, new ActionListener<IndexResponse>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(IndexResponse response) {
|
public void onResponse(IndexResponse response) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class RestMainAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
|
clusterStateRequest.listenerThreaded(false);
|
||||||
clusterStateRequest.masterNodeTimeout(TimeValue.timeValueMillis(0));
|
clusterStateRequest.masterNodeTimeout(TimeValue.timeValueMillis(0));
|
||||||
clusterStateRequest.local(true);
|
clusterStateRequest.local(true);
|
||||||
clusterStateRequest.filterAll().filterBlocks(false);
|
clusterStateRequest.filterAll().filterBlocks(false);
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class RestMoreLikeThisAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
MoreLikeThisRequest mltRequest = moreLikeThisRequest(request.param("index")).type(request.param("type")).id(request.param("id"));
|
MoreLikeThisRequest mltRequest = moreLikeThisRequest(request.param("index")).type(request.param("type")).id(request.param("id"));
|
||||||
|
mltRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
mltRequest.fields(request.paramAsStringArray("mlt_fields", null));
|
mltRequest.fields(request.paramAsStringArray("mlt_fields", null));
|
||||||
mltRequest.percentTermsToMatch(request.paramAsFloat("percent_terms_to_match", -1));
|
mltRequest.percentTermsToMatch(request.paramAsFloat("percent_terms_to_match", -1));
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class RestPercolateAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
PercolateRequest percolateRequest = new PercolateRequest(request.param("index"), request.param("type"));
|
PercolateRequest percolateRequest = new PercolateRequest(request.param("index"), request.param("type"));
|
||||||
|
percolateRequest.listenerThreaded(false);
|
||||||
percolateRequest.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength(), request.contentUnsafe());
|
percolateRequest.source(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength(), request.contentUnsafe());
|
||||||
|
|
||||||
// we just send a response, no need to fork
|
// we just send a response, no need to fork
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class RestMultiSearchAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
MultiSearchRequest multiSearchRequest = new MultiSearchRequest();
|
MultiSearchRequest multiSearchRequest = new MultiSearchRequest();
|
||||||
|
multiSearchRequest.listenerThreaded(false);
|
||||||
|
|
||||||
String[] indices = RestActions.splitIndices(request.param("index"));
|
String[] indices = RestActions.splitIndices(request.param("index"));
|
||||||
String[] types = RestActions.splitTypes(request.param("type"));
|
String[] types = RestActions.splitTypes(request.param("type"));
|
||||||
|
|
|
@ -60,12 +60,12 @@ public class RestSearchScrollAction extends BaseRestHandler {
|
||||||
scrollId = request.contentAsString();
|
scrollId = request.contentAsString();
|
||||||
}
|
}
|
||||||
SearchScrollRequest searchScrollRequest = new SearchScrollRequest(scrollId);
|
SearchScrollRequest searchScrollRequest = new SearchScrollRequest(scrollId);
|
||||||
|
searchScrollRequest.listenerThreaded(false);
|
||||||
try {
|
try {
|
||||||
String scroll = request.param("scroll");
|
String scroll = request.param("scroll");
|
||||||
if (scroll != null) {
|
if (scroll != null) {
|
||||||
searchScrollRequest.scroll(new Scroll(parseTimeValue(scroll, null)));
|
searchScrollRequest.scroll(new Scroll(parseTimeValue(scroll, null)));
|
||||||
}
|
}
|
||||||
searchScrollRequest.listenerThreaded(false);
|
|
||||||
SearchOperationThreading operationThreading = SearchOperationThreading.fromString(request.param("operation_threading"), null);
|
SearchOperationThreading operationThreading = SearchOperationThreading.fromString(request.param("operation_threading"), null);
|
||||||
if (operationThreading != null) {
|
if (operationThreading != null) {
|
||||||
if (operationThreading == SearchOperationThreading.NO_THREADS) {
|
if (operationThreading == SearchOperationThreading.NO_THREADS) {
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class RestUpdateAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||||
UpdateRequest updateRequest = new UpdateRequest(request.param("index"), request.param("type"), request.param("id"));
|
UpdateRequest updateRequest = new UpdateRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
|
updateRequest.listenerThreaded(false);
|
||||||
updateRequest.routing(request.param("routing"));
|
updateRequest.routing(request.param("routing"));
|
||||||
updateRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
updateRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
||||||
updateRequest.timeout(request.paramAsTime("timeout", updateRequest.timeout()));
|
updateRequest.timeout(request.paramAsTime("timeout", updateRequest.timeout()));
|
||||||
|
@ -68,8 +69,6 @@ public class RestUpdateAction extends BaseRestHandler {
|
||||||
updateRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel));
|
updateRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel));
|
||||||
}
|
}
|
||||||
updateRequest.percolate(request.param("percolate", null));
|
updateRequest.percolate(request.param("percolate", null));
|
||||||
// we just send a response, no need to fork
|
|
||||||
updateRequest.listenerThreaded(false);
|
|
||||||
updateRequest.script(request.param("script"));
|
updateRequest.script(request.param("script"));
|
||||||
updateRequest.scriptLang(request.param("lang"));
|
updateRequest.scriptLang(request.param("lang"));
|
||||||
for (Map.Entry<String, String> entry : request.params().entrySet()) {
|
for (Map.Entry<String, String> entry : request.params().entrySet()) {
|
||||||
|
|
Loading…
Reference in New Issue