mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Merge branch 'master' into index-lifecycle
This commit is contained in:
commit
ec93756600
@ -21,18 +21,15 @@ package org.elasticsearch.client;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
||||
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
|
||||
@ -45,7 +42,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRespon
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
@ -55,15 +51,14 @@ import org.elasticsearch.action.admin.indices.rollover.RolloverResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -93,9 +88,9 @@ public final class IndicesClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public DeleteIndexResponse delete(DeleteIndexRequest deleteIndexRequest, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse delete(DeleteIndexRequest deleteIndexRequest, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex, options,
|
||||
DeleteIndexResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,9 +101,9 @@ public final class IndicesClient {
|
||||
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions options, ActionListener<DeleteIndexResponse> listener) {
|
||||
public void deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex, options,
|
||||
DeleteIndexResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,9 +142,9 @@ public final class IndicesClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public PutMappingResponse putMapping(PutMappingRequest putMappingRequest, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse putMapping(PutMappingRequest putMappingRequest, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(putMappingRequest, RequestConverters::putMapping, options,
|
||||
PutMappingResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,9 +155,10 @@ public final class IndicesClient {
|
||||
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void putMappingAsync(PutMappingRequest putMappingRequest, RequestOptions options, ActionListener<PutMappingResponse> listener) {
|
||||
public void putMappingAsync(PutMappingRequest putMappingRequest, RequestOptions options,
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(putMappingRequest, RequestConverters::putMapping, options,
|
||||
PutMappingResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -231,9 +227,9 @@ public final class IndicesClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public IndicesAliasesResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases, options,
|
||||
IndicesAliasesResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -245,9 +241,9 @@ public final class IndicesClient {
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void updateAliasesAsync(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options,
|
||||
ActionListener<IndicesAliasesResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases, options,
|
||||
IndicesAliasesResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -286,9 +282,9 @@ public final class IndicesClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public CloseIndexResponse close(CloseIndexRequest closeIndexRequest, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse close(CloseIndexRequest closeIndexRequest, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(closeIndexRequest, RequestConverters::closeIndex, options,
|
||||
CloseIndexResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,9 +295,9 @@ public final class IndicesClient {
|
||||
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void closeAsync(CloseIndexRequest closeIndexRequest, RequestOptions options, ActionListener<CloseIndexResponse> listener) {
|
||||
public void closeAsync(CloseIndexRequest closeIndexRequest, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(closeIndexRequest, RequestConverters::closeIndex, options,
|
||||
CloseIndexResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
|
||||
@ -706,9 +702,9 @@ public final class IndicesClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public UpdateSettingsResponse putSettings(UpdateSettingsRequest updateSettingsRequest, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse putSettings(UpdateSettingsRequest updateSettingsRequest, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings, options,
|
||||
UpdateSettingsResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -720,9 +716,9 @@ public final class IndicesClient {
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, RequestOptions options,
|
||||
ActionListener<UpdateSettingsResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings, options,
|
||||
UpdateSettingsResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -734,10 +730,10 @@ public final class IndicesClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public PutIndexTemplateResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest,
|
||||
RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest,
|
||||
RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate, options,
|
||||
PutIndexTemplateResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -749,9 +745,9 @@ public final class IndicesClient {
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest, RequestOptions options,
|
||||
ActionListener<PutIndexTemplateResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate, options,
|
||||
PutIndexTemplateResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.client;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.io.Streams;
|
||||
import org.elasticsearch.common.xcontent.DeprecationHandler;
|
||||
@ -30,7 +31,6 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest;
|
||||
import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse;
|
||||
import org.elasticsearch.protocol.xpack.license.GetLicenseRequest;
|
||||
import org.elasticsearch.protocol.xpack.license.GetLicenseResponse;
|
||||
import org.elasticsearch.protocol.xpack.license.PutLicenseRequest;
|
||||
@ -106,9 +106,9 @@ public final class LicenseClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public DeleteLicenseResponse deleteLicense(DeleteLicenseRequest request, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse deleteLicense(DeleteLicenseRequest request, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(request, RequestConverters::deleteLicense, options,
|
||||
DeleteLicenseResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,9 +116,9 @@ public final class LicenseClient {
|
||||
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void deleteLicenseAsync(DeleteLicenseRequest request, RequestOptions options, ActionListener<DeleteLicenseResponse> listener) {
|
||||
public void deleteLicenseAsync(DeleteLicenseRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(request, RequestConverters::deleteLicense, options,
|
||||
DeleteLicenseResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,8 @@
|
||||
package org.elasticsearch.client;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobResponse;
|
||||
import org.elasticsearch.protocol.xpack.ml.PutJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.PutJobResponse;
|
||||
|
||||
@ -77,4 +79,51 @@ public final class MachineLearningClient {
|
||||
listener,
|
||||
Collections.emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a Machine Learning Job.
|
||||
* When you open a new job, it starts with an empty model.
|
||||
*
|
||||
* When you open an existing job, the most recent model state is automatically loaded.
|
||||
* The job is ready to resume its analysis from where it left off, once new data is received.
|
||||
*
|
||||
* <p>
|
||||
* For additional info
|
||||
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html"></a>
|
||||
* </p>
|
||||
* @param request request containing job_id and additional optional options
|
||||
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
* @return response containing if the job was successfully opened or not.
|
||||
* @throws IOException when there is a serialization issue sending the request or receiving the response
|
||||
*/
|
||||
public OpenJobResponse openJob(OpenJobRequest request, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(request,
|
||||
RequestConverters::machineLearningOpenJob,
|
||||
options,
|
||||
OpenJobResponse::fromXContent,
|
||||
Collections.emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a Machine Learning Job asynchronously, notifies listener on completion.
|
||||
* When you open a new job, it starts with an empty model.
|
||||
*
|
||||
* When you open an existing job, the most recent model state is automatically loaded.
|
||||
* The job is ready to resume its analysis from where it left off, once new data is received.
|
||||
* <p>
|
||||
* For additional info
|
||||
* see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html"></a>
|
||||
* </p>
|
||||
* @param request request containing job_id and additional optional options
|
||||
* @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
||||
* @param listener Listener to be notified upon request completion
|
||||
*/
|
||||
public void openJobAsync(OpenJobRequest request, RequestOptions options, ActionListener<OpenJobResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(request,
|
||||
RequestConverters::machineLearningOpenJob,
|
||||
options,
|
||||
OpenJobResponse::fromXContent,
|
||||
listener,
|
||||
Collections.emptySet());
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ import org.elasticsearch.protocol.xpack.indexlifecycle.StopILMRequest;
|
||||
import org.elasticsearch.protocol.xpack.license.GetLicenseRequest;
|
||||
import org.elasticsearch.protocol.xpack.license.PutLicenseRequest;
|
||||
import org.elasticsearch.protocol.xpack.migration.IndexUpgradeInfoRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.PutJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.watcher.DeleteWatchRequest;
|
||||
import org.elasticsearch.protocol.xpack.watcher.PutWatchRequest;
|
||||
@ -1266,6 +1267,19 @@ final class RequestConverters {
|
||||
return request;
|
||||
}
|
||||
|
||||
static Request machineLearningOpenJob(OpenJobRequest openJobRequest) throws IOException {
|
||||
String endpoint = new EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack")
|
||||
.addPathPartAsIs("ml")
|
||||
.addPathPartAsIs("anomaly_detectors")
|
||||
.addPathPart(openJobRequest.getJobId())
|
||||
.addPathPartAsIs("_open")
|
||||
.build();
|
||||
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
|
||||
request.setJsonEntity(openJobRequest.toString());
|
||||
return request;
|
||||
}
|
||||
|
||||
static Request getMigrationAssistance(IndexUpgradeInfoRequest indexUpgradeInfoRequest) {
|
||||
EndpointBuilder endpointBuilder = new EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack/migration/assistance")
|
||||
|
@ -27,7 +27,6 @@ import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
@ -53,6 +52,7 @@ import org.elasticsearch.action.search.MultiSearchResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.SearchScrollRequest;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.common.CheckedConsumer;
|
||||
@ -928,9 +928,9 @@ public class RestHighLevelClient implements Closeable {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public DeleteStoredScriptResponse deleteScript(DeleteStoredScriptRequest request, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse deleteScript(DeleteStoredScriptRequest request, RequestOptions options) throws IOException {
|
||||
return performRequestAndParseEntity(request, RequestConverters::deleteScript, options,
|
||||
DeleteStoredScriptResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -942,9 +942,9 @@ public class RestHighLevelClient implements Closeable {
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void deleteScriptAsync(DeleteStoredScriptRequest request, RequestOptions options,
|
||||
ActionListener<DeleteStoredScriptResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
performRequestAsyncAndParseEntity(request, RequestConverters::deleteScript, options,
|
||||
DeleteStoredScriptResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,23 +21,21 @@ package org.elasticsearch.client;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -95,9 +93,9 @@ public final class SnapshotClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public PutRepositoryResponse createRepository(PutRepositoryRequest putRepositoryRequest, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse createRepository(PutRepositoryRequest putRepositoryRequest, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(putRepositoryRequest, RequestConverters::createRepository, options,
|
||||
PutRepositoryResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,9 +107,9 @@ public final class SnapshotClient {
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void createRepositoryAsync(PutRepositoryRequest putRepositoryRequest, RequestOptions options,
|
||||
ActionListener<PutRepositoryResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(putRepositoryRequest, RequestConverters::createRepository, options,
|
||||
PutRepositoryResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,10 +121,10 @@ public final class SnapshotClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public DeleteRepositoryResponse deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options)
|
||||
public AcknowledgedResponse deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options)
|
||||
throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository, options,
|
||||
DeleteRepositoryResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,9 +136,9 @@ public final class SnapshotClient {
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void deleteRepositoryAsync(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options,
|
||||
ActionListener<DeleteRepositoryResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository, options,
|
||||
DeleteRepositoryResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -294,9 +292,9 @@ public final class SnapshotClient {
|
||||
* @return the response
|
||||
* @throws IOException in case there is a problem sending the request or parsing back the response
|
||||
*/
|
||||
public DeleteSnapshotResponse delete(DeleteSnapshotRequest deleteSnapshotRequest, RequestOptions options) throws IOException {
|
||||
public AcknowledgedResponse delete(DeleteSnapshotRequest deleteSnapshotRequest, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity(deleteSnapshotRequest, RequestConverters::deleteSnapshot, options,
|
||||
DeleteSnapshotResponse::fromXContent, emptySet());
|
||||
AcknowledgedResponse::fromXContent, emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,8 +307,8 @@ public final class SnapshotClient {
|
||||
* @param listener the listener to be notified upon request completion
|
||||
*/
|
||||
public void deleteAsync(DeleteSnapshotRequest deleteSnapshotRequest, RequestOptions options,
|
||||
ActionListener<DeleteSnapshotResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity(deleteSnapshotRequest, RequestConverters::deleteSnapshot, options,
|
||||
DeleteSnapshotResponse::fromXContent, listener, emptySet());
|
||||
AcknowledgedResponse::fromXContent, listener, emptySet());
|
||||
}
|
||||
}
|
||||
|
@ -27,18 +27,15 @@ import org.elasticsearch.ElasticsearchStatusException;
|
||||
import org.elasticsearch.action.admin.indices.alias.Alias;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
||||
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
|
||||
@ -51,7 +48,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRespon
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
@ -61,20 +57,19 @@ import org.elasticsearch.action.admin.indices.rollover.RolloverResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeResponse;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeType;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.support.broadcast.BroadcastResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
||||
@ -411,7 +406,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
mappingBuilder.endObject().endObject().endObject();
|
||||
putMappingRequest.source(mappingBuilder);
|
||||
|
||||
PutMappingResponse putMappingResponse =
|
||||
AcknowledgedResponse putMappingResponse =
|
||||
execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
|
||||
@ -431,7 +426,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
mappingBuilder.endObject().endObject().endObject();
|
||||
putMappingRequest.source(mappingBuilder);
|
||||
|
||||
PutMappingResponse putMappingResponse =
|
||||
AcknowledgedResponse putMappingResponse =
|
||||
execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
|
||||
@ -467,7 +462,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
mappingBuilder.endObject().endObject().endObject();
|
||||
putMappingRequest.source(mappingBuilder);
|
||||
|
||||
PutMappingResponse putMappingResponse =
|
||||
AcknowledgedResponse putMappingResponse =
|
||||
execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
|
||||
@ -497,7 +492,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
createIndex(indexName, Settings.EMPTY);
|
||||
|
||||
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(indexName);
|
||||
DeleteIndexResponse deleteIndexResponse =
|
||||
AcknowledgedResponse deleteIndexResponse =
|
||||
execute(deleteIndexRequest, highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync);
|
||||
assertTrue(deleteIndexResponse.isAcknowledged());
|
||||
|
||||
@ -529,7 +524,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
AliasActions addAction = new AliasActions(AliasActions.Type.ADD).index(index).aliases(alias);
|
||||
addAction.routing("routing").searchRouting("search_routing").filter("{\"term\":{\"year\":2016}}");
|
||||
aliasesAddRequest.addAliasAction(addAction);
|
||||
IndicesAliasesResponse aliasesAddResponse = execute(aliasesAddRequest, highLevelClient().indices()::updateAliases,
|
||||
AcknowledgedResponse aliasesAddResponse = execute(aliasesAddRequest, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync);
|
||||
assertTrue(aliasesAddResponse.isAcknowledged());
|
||||
assertThat(aliasExists(alias), equalTo(true));
|
||||
@ -547,7 +542,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
aliasesAddRemoveRequest.addAliasAction(addAction);
|
||||
AliasActions removeAction = new AliasActions(AliasActions.Type.REMOVE).index(index).alias(alias);
|
||||
aliasesAddRemoveRequest.addAliasAction(removeAction);
|
||||
IndicesAliasesResponse aliasesAddRemoveResponse = execute(aliasesAddRemoveRequest, highLevelClient().indices()::updateAliases,
|
||||
AcknowledgedResponse aliasesAddRemoveResponse = execute(aliasesAddRemoveRequest, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync);
|
||||
assertTrue(aliasesAddRemoveResponse.isAcknowledged());
|
||||
assertThat(aliasExists(alias), equalTo(false));
|
||||
@ -558,7 +553,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
IndicesAliasesRequest aliasesRemoveIndexRequest = new IndicesAliasesRequest();
|
||||
AliasActions removeIndexAction = new AliasActions(AliasActions.Type.REMOVE_INDEX).index(index);
|
||||
aliasesRemoveIndexRequest.addAliasAction(removeIndexAction);
|
||||
IndicesAliasesResponse aliasesRemoveIndexResponse = execute(aliasesRemoveIndexRequest, highLevelClient().indices()::updateAliases,
|
||||
AcknowledgedResponse aliasesRemoveIndexResponse = execute(aliasesRemoveIndexRequest, highLevelClient().indices()::updateAliases,
|
||||
highLevelClient().indices()::updateAliasesAsync);
|
||||
assertTrue(aliasesRemoveIndexResponse.isAcknowledged());
|
||||
assertThat(aliasExists(alias), equalTo(false));
|
||||
@ -654,7 +649,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
assertThat(response.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus()));
|
||||
|
||||
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(index);
|
||||
CloseIndexResponse closeIndexResponse = execute(closeIndexRequest, highLevelClient().indices()::close,
|
||||
AcknowledgedResponse closeIndexResponse = execute(closeIndexRequest, highLevelClient().indices()::close,
|
||||
highLevelClient().indices()::closeAsync);
|
||||
assertTrue(closeIndexResponse.isAcknowledged());
|
||||
|
||||
@ -1144,7 +1139,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
assertThat(dynamicSetting.getDefault(Settings.EMPTY), not(dynamicSettingValue));
|
||||
UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest();
|
||||
dynamicSettingRequest.settings(Settings.builder().put(dynamicSettingKey, dynamicSettingValue).build());
|
||||
UpdateSettingsResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings,
|
||||
AcknowledgedResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings,
|
||||
highLevelClient().indices()::putSettingsAsync);
|
||||
|
||||
assertTrue(response.isAcknowledged());
|
||||
@ -1227,7 +1222,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
||||
.mapping("doc", "host_name", "type=keyword", "description", "type=text")
|
||||
.alias(new Alias("alias-1").indexRouting("abc")).alias(new Alias("{index}-write").searchRouting("xyz"));
|
||||
|
||||
PutIndexTemplateResponse putTemplateResponse = execute(putTemplateRequest,
|
||||
AcknowledgedResponse putTemplateResponse = execute(putTemplateRequest,
|
||||
highLevelClient().indices()::putTemplate, highLevelClient().indices()::putTemplateAsync);
|
||||
assertThat(putTemplateResponse.isAcknowledged(), equalTo(true));
|
||||
|
||||
|
@ -20,6 +20,8 @@ package org.elasticsearch.client;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobResponse;
|
||||
import org.elasticsearch.protocol.xpack.ml.PutJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.PutJobResponse;
|
||||
import org.elasticsearch.protocol.xpack.ml.job.config.AnalysisConfig;
|
||||
@ -46,12 +48,24 @@ public class MachineLearningIT extends ESRestHighLevelClientTestCase {
|
||||
assertThat(createdJob.getJobType(), is(Job.ANOMALY_DETECTOR_JOB_TYPE));
|
||||
}
|
||||
|
||||
public void testOpenJob() throws Exception {
|
||||
String jobId = randomValidJobId();
|
||||
Job job = buildJob(jobId);
|
||||
MachineLearningClient machineLearningClient = highLevelClient().machineLearning();
|
||||
|
||||
machineLearningClient.putJob(new PutJobRequest(job), RequestOptions.DEFAULT);
|
||||
|
||||
OpenJobResponse response = execute(new OpenJobRequest(jobId), machineLearningClient::openJob, machineLearningClient::openJobAsync);
|
||||
|
||||
assertTrue(response.isOpened());
|
||||
}
|
||||
|
||||
public static String randomValidJobId() {
|
||||
CodepointSetGenerator generator = new CodepointSetGenerator("abcdefghijklmnopqrstuvwxyz0123456789".toCharArray());
|
||||
return generator.ofCodePointsLength(random(), 10, 10);
|
||||
}
|
||||
|
||||
private static Job buildJob(String jobId) {
|
||||
public static Job buildJob(String jobId) {
|
||||
Job.Builder builder = new Job.Builder(jobId);
|
||||
builder.setDescription(randomAlphaOfLength(10));
|
||||
|
||||
|
@ -131,6 +131,7 @@ import org.elasticsearch.protocol.xpack.indexlifecycle.SetIndexLifecyclePolicyRe
|
||||
import org.elasticsearch.protocol.xpack.indexlifecycle.StartILMRequest;
|
||||
import org.elasticsearch.protocol.xpack.indexlifecycle.StopILMRequest;
|
||||
import org.elasticsearch.protocol.xpack.migration.IndexUpgradeInfoRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.watcher.DeleteWatchRequest;
|
||||
import org.elasticsearch.protocol.xpack.watcher.PutWatchRequest;
|
||||
import org.elasticsearch.repositories.fs.FsRepository;
|
||||
@ -2672,6 +2673,19 @@ public class RequestConvertersTests extends ESTestCase {
|
||||
assertThat(request.getEntity(), nullValue());
|
||||
}
|
||||
|
||||
public void testPostMachineLearningOpenJob() throws Exception {
|
||||
String jobId = "some-job-id";
|
||||
OpenJobRequest openJobRequest = new OpenJobRequest(jobId);
|
||||
openJobRequest.setTimeout(TimeValue.timeValueMinutes(10));
|
||||
|
||||
Request request = RequestConverters.machineLearningOpenJob(openJobRequest);
|
||||
assertEquals(HttpPost.METHOD_NAME, request.getMethod());
|
||||
assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_open", request.getEndpoint());
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
request.getEntity().writeTo(bos);
|
||||
assertEquals(bos.toString("UTF-8"), "{\"job_id\":\""+ jobId +"\",\"timeout\":\"10m\"}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Randomize the {@link FetchSourceContext} request parameters.
|
||||
*/
|
||||
|
@ -21,24 +21,22 @@ package org.elasticsearch.client;
|
||||
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.repositories.fs.FsRepository;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
@ -55,7 +53,7 @@ import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
|
||||
private PutRepositoryResponse createTestRepository(String repository, String type, String settings) throws IOException {
|
||||
private AcknowledgedResponse createTestRepository(String repository, String type, String settings) throws IOException {
|
||||
PutRepositoryRequest request = new PutRepositoryRequest(repository);
|
||||
request.settings(settings, XContentType.JSON);
|
||||
request.type(type);
|
||||
@ -71,7 +69,7 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
}
|
||||
|
||||
public void testCreateRepository() throws IOException {
|
||||
PutRepositoryResponse response = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
AcknowledgedResponse response = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
assertTrue(response.isAcknowledged());
|
||||
}
|
||||
|
||||
@ -117,14 +115,14 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
assertThat(1, equalTo(response.repositories().size()));
|
||||
|
||||
DeleteRepositoryRequest deleteRequest = new DeleteRepositoryRequest(repository);
|
||||
DeleteRepositoryResponse deleteResponse = execute(deleteRequest, highLevelClient().snapshot()::deleteRepository,
|
||||
AcknowledgedResponse deleteResponse = execute(deleteRequest, highLevelClient().snapshot()::deleteRepository,
|
||||
highLevelClient().snapshot()::deleteRepositoryAsync);
|
||||
|
||||
assertTrue(deleteResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
public void testVerifyRepository() throws IOException {
|
||||
PutRepositoryResponse putRepositoryResponse = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
AcknowledgedResponse putRepositoryResponse = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
assertTrue(putRepositoryResponse.isAcknowledged());
|
||||
|
||||
VerifyRepositoryRequest request = new VerifyRepositoryRequest("test");
|
||||
@ -153,7 +151,7 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
String snapshot1 = "test_snapshot1";
|
||||
String snapshot2 = "test_snapshot2";
|
||||
|
||||
PutRepositoryResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
AcknowledgedResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
assertTrue(putRepositoryResponse.isAcknowledged());
|
||||
|
||||
CreateSnapshotRequest createSnapshotRequest1 = new CreateSnapshotRequest(repository, snapshot1);
|
||||
@ -187,7 +185,7 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
String testSnapshot = "snapshot";
|
||||
String testIndex = "test_index";
|
||||
|
||||
PutRepositoryResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
AcknowledgedResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
assertTrue(putRepositoryResponse.isAcknowledged());
|
||||
|
||||
createIndex(testIndex, Settings.EMPTY);
|
||||
@ -216,7 +214,7 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
String testIndex = "test_index";
|
||||
String restoredIndex = testIndex + "_restored";
|
||||
|
||||
PutRepositoryResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
AcknowledgedResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
assertTrue(putRepositoryResponse.isAcknowledged());
|
||||
|
||||
createIndex(testIndex, Settings.EMPTY);
|
||||
@ -250,7 +248,7 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
String repository = "test_repository";
|
||||
String snapshot = "test_snapshot";
|
||||
|
||||
PutRepositoryResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
AcknowledgedResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}");
|
||||
assertTrue(putRepositoryResponse.isAcknowledged());
|
||||
|
||||
CreateSnapshotRequest createSnapshotRequest = new CreateSnapshotRequest(repository, snapshot);
|
||||
@ -260,7 +258,7 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase {
|
||||
assertEquals(RestStatus.OK, createSnapshotResponse.status());
|
||||
|
||||
DeleteSnapshotRequest request = new DeleteSnapshotRequest(repository, snapshot);
|
||||
DeleteSnapshotResponse response = execute(request, highLevelClient().snapshot()::delete, highLevelClient().snapshot()::deleteAsync);
|
||||
AcknowledgedResponse response = execute(request, highLevelClient().snapshot()::delete, highLevelClient().snapshot()::deleteAsync);
|
||||
|
||||
assertTrue(response.isAcknowledged());
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.elasticsearch.ElasticsearchStatusException;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
@ -90,7 +90,7 @@ public class StoredScriptsIT extends ESRestHighLevelClientTestCase {
|
||||
deleteRequest.masterNodeTimeout("50s");
|
||||
deleteRequest.timeout("50s");
|
||||
|
||||
DeleteStoredScriptResponse deleteResponse = execute(deleteRequest, highLevelClient()::deleteScript,
|
||||
AcknowledgedResponse deleteResponse = execute(deleteRequest, highLevelClient()::deleteScript,
|
||||
highLevelClient()::deleteScriptAsync);
|
||||
|
||||
assertThat(deleteResponse.isAcknowledged(), equalTo(true));
|
||||
|
@ -25,7 +25,6 @@ import org.elasticsearch.action.LatchedActionListener;
|
||||
import org.elasticsearch.action.admin.indices.alias.Alias;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
||||
@ -33,11 +32,9 @@ import org.elasticsearch.action.admin.indices.analyze.DetailAnalyzeResponse;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
||||
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
|
||||
@ -50,7 +47,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRespon
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
@ -60,20 +56,19 @@ import org.elasticsearch.action.admin.indices.rollover.RolloverResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeResponse;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ResizeType;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
|
||||
import org.elasticsearch.client.GetAliasesResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
@ -220,7 +215,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::delete-index-request-indicesOptions
|
||||
|
||||
// tag::delete-index-execute
|
||||
DeleteIndexResponse deleteIndexResponse = client.indices().delete(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse deleteIndexResponse = client.indices().delete(request, RequestOptions.DEFAULT);
|
||||
// end::delete-index-execute
|
||||
|
||||
// tag::delete-index-response
|
||||
@ -255,10 +250,10 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
DeleteIndexRequest request = new DeleteIndexRequest("posts");
|
||||
|
||||
// tag::delete-index-execute-listener
|
||||
ActionListener<DeleteIndexResponse> listener =
|
||||
new ActionListener<DeleteIndexResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteIndexResponse deleteIndexResponse) {
|
||||
public void onResponse(AcknowledgedResponse deleteIndexResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -480,7 +475,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
"}", // <1>
|
||||
XContentType.JSON);
|
||||
// end::put-mapping-request-source
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
@ -494,7 +489,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
jsonMap.put("properties", properties);
|
||||
request.source(jsonMap); // <1>
|
||||
//end::put-mapping-map
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
{
|
||||
@ -515,14 +510,14 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
builder.endObject();
|
||||
request.source(builder); // <1>
|
||||
//end::put-mapping-xcontent
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
{
|
||||
//tag::put-mapping-shortcut
|
||||
request.source("message", "type=text"); // <1>
|
||||
//end::put-mapping-shortcut
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
@ -536,7 +531,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::put-mapping-request-masterTimeout
|
||||
|
||||
// tag::put-mapping-execute
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
// end::put-mapping-execute
|
||||
|
||||
// tag::put-mapping-response
|
||||
@ -558,10 +553,10 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
PutMappingRequest request = new PutMappingRequest("twitter").type("tweet");
|
||||
|
||||
// tag::put-mapping-execute-listener
|
||||
ActionListener<PutMappingResponse> listener =
|
||||
new ActionListener<PutMappingResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutMappingResponse putMappingResponse) {
|
||||
public void onResponse(AcknowledgedResponse putMappingResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -601,7 +596,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
" }\n" +
|
||||
"}", // <1>
|
||||
XContentType.JSON);
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
@ -658,7 +653,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
" }\n" +
|
||||
"}", // <1>
|
||||
XContentType.JSON);
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
@ -731,7 +726,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
" }\n" +
|
||||
"}", // <1>
|
||||
XContentType.JSON);
|
||||
PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||
assertTrue(putMappingResponse.isAcknowledged());
|
||||
}
|
||||
|
||||
@ -1497,7 +1492,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::close-index-request-indicesOptions
|
||||
|
||||
// tag::close-index-execute
|
||||
CloseIndexResponse closeIndexResponse = client.indices().close(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse closeIndexResponse = client.indices().close(request, RequestOptions.DEFAULT);
|
||||
// end::close-index-execute
|
||||
|
||||
// tag::close-index-response
|
||||
@ -1506,10 +1501,10 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
assertTrue(acknowledged);
|
||||
|
||||
// tag::close-index-execute-listener
|
||||
ActionListener<CloseIndexResponse> listener =
|
||||
new ActionListener<CloseIndexResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(CloseIndexResponse closeIndexResponse) {
|
||||
public void onResponse(AcknowledgedResponse closeIndexResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -1649,7 +1644,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::update-aliases-request-masterTimeout
|
||||
|
||||
// tag::update-aliases-execute
|
||||
IndicesAliasesResponse indicesAliasesResponse =
|
||||
AcknowledgedResponse indicesAliasesResponse =
|
||||
client.indices().updateAliases(request, RequestOptions.DEFAULT);
|
||||
// end::update-aliases-execute
|
||||
|
||||
@ -1665,10 +1660,10 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
request.addAliasAction(aliasAction);
|
||||
|
||||
// tag::update-aliases-execute-listener
|
||||
ActionListener<IndicesAliasesResponse> listener =
|
||||
new ActionListener<IndicesAliasesResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(IndicesAliasesResponse indicesAliasesResponse) {
|
||||
public void onResponse(AcknowledgedResponse indicesAliasesResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -2056,7 +2051,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::put-settings-request-indicesOptions
|
||||
|
||||
// tag::put-settings-execute
|
||||
UpdateSettingsResponse updateSettingsResponse =
|
||||
AcknowledgedResponse updateSettingsResponse =
|
||||
client.indices().putSettings(request, RequestOptions.DEFAULT);
|
||||
// end::put-settings-execute
|
||||
|
||||
@ -2066,11 +2061,11 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
assertTrue(acknowledged);
|
||||
|
||||
// tag::put-settings-execute-listener
|
||||
ActionListener<UpdateSettingsResponse> listener =
|
||||
new ActionListener<UpdateSettingsResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(UpdateSettingsResponse updateSettingsResponse) {
|
||||
public void onResponse(AcknowledgedResponse updateSettingsResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -2219,7 +2214,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
request.create(false); // make test happy
|
||||
|
||||
// tag::put-template-execute
|
||||
PutIndexTemplateResponse putTemplateResponse = client.indices().putTemplate(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse putTemplateResponse = client.indices().putTemplate(request, RequestOptions.DEFAULT);
|
||||
// end::put-template-execute
|
||||
|
||||
// tag::put-template-response
|
||||
@ -2228,10 +2223,10 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
assertTrue(acknowledged);
|
||||
|
||||
// tag::put-template-execute-listener
|
||||
ActionListener<PutIndexTemplateResponse> listener =
|
||||
new ActionListener<PutIndexTemplateResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutIndexTemplateResponse putTemplateResponse) {
|
||||
public void onResponse(AcknowledgedResponse putTemplateResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -2461,7 +2456,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
.indices("my_index")
|
||||
.type("_doc")
|
||||
.source("my_field", "type=text,analyzer=english");
|
||||
PutMappingResponse pmResp = client.indices().putMapping(pmReq, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse pmResp = client.indices().putMapping(pmReq, RequestOptions.DEFAULT);
|
||||
assertTrue(pmResp.isAcknowledged());
|
||||
|
||||
{
|
||||
|
@ -22,12 +22,12 @@ package org.elasticsearch.client.documentation;
|
||||
import org.elasticsearch.Build;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.LatchedActionListener;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.common.Booleans;
|
||||
import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest;
|
||||
import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse;
|
||||
import org.elasticsearch.protocol.xpack.license.GetLicenseRequest;
|
||||
import org.elasticsearch.protocol.xpack.license.GetLicenseResponse;
|
||||
import org.elasticsearch.protocol.xpack.license.LicensesStatus;
|
||||
@ -120,7 +120,7 @@ public class LicensingDocumentationIT extends ESRestHighLevelClientTestCase {
|
||||
//tag::delete-license-execute
|
||||
DeleteLicenseRequest request = new DeleteLicenseRequest();
|
||||
|
||||
DeleteLicenseResponse response = client.license().deleteLicense(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.license().deleteLicense(request, RequestOptions.DEFAULT);
|
||||
//end::delete-license-execute
|
||||
|
||||
//tag::delete-license-response
|
||||
@ -132,9 +132,9 @@ public class LicensingDocumentationIT extends ESRestHighLevelClientTestCase {
|
||||
{
|
||||
DeleteLicenseRequest request = new DeleteLicenseRequest();
|
||||
// tag::delete-license-execute-listener
|
||||
ActionListener<DeleteLicenseResponse> listener = new ActionListener<DeleteLicenseResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener = new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteLicenseResponse deleteLicenseResponse) {
|
||||
public void onResponse(AcknowledgedResponse deleteLicenseResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,12 @@ package org.elasticsearch.client.documentation;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.LatchedActionListener;
|
||||
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
|
||||
import org.elasticsearch.client.MachineLearningIT;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.OpenJobResponse;
|
||||
import org.elasticsearch.protocol.xpack.ml.PutJobRequest;
|
||||
import org.elasticsearch.protocol.xpack.ml.PutJobResponse;
|
||||
import org.elasticsearch.protocol.xpack.ml.job.config.AnalysisConfig;
|
||||
@ -118,4 +121,54 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase {
|
||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||
}
|
||||
}
|
||||
|
||||
public void testOpenJob() throws Exception {
|
||||
RestHighLevelClient client = highLevelClient();
|
||||
|
||||
Job job = MachineLearningIT.buildJob("opening-my-first-machine-learning-job");
|
||||
client.machineLearning().putJob(new PutJobRequest(job), RequestOptions.DEFAULT);
|
||||
|
||||
Job secondJob = MachineLearningIT.buildJob("opening-my-second-machine-learning-job");
|
||||
client.machineLearning().putJob(new PutJobRequest(secondJob), RequestOptions.DEFAULT);
|
||||
|
||||
{
|
||||
//tag::x-pack-ml-open-job-request
|
||||
OpenJobRequest openJobRequest = new OpenJobRequest("opening-my-first-machine-learning-job"); //<1>
|
||||
openJobRequest.setTimeout(TimeValue.timeValueMinutes(10)); //<2>
|
||||
//end::x-pack-ml-open-job-request
|
||||
|
||||
//tag::x-pack-ml-open-job-execute
|
||||
OpenJobResponse openJobResponse = client.machineLearning().openJob(openJobRequest, RequestOptions.DEFAULT);
|
||||
boolean isOpened = openJobResponse.isOpened(); //<1>
|
||||
//end::x-pack-ml-open-job-execute
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
//tag::x-pack-ml-open-job-listener
|
||||
ActionListener<OpenJobResponse> listener = new ActionListener<OpenJobResponse>() {
|
||||
@Override
|
||||
public void onResponse(OpenJobResponse openJobResponse) {
|
||||
//<1>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
//<2>
|
||||
}
|
||||
};
|
||||
//end::x-pack-ml-open-job-listener
|
||||
OpenJobRequest openJobRequest = new OpenJobRequest("opening-my-second-machine-learning-job");
|
||||
// Replace the empty listener by a blocking listener in test
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
listener = new LatchedActionListener<>(listener, latch);
|
||||
|
||||
// tag::x-pack-ml-open-job-execute-async
|
||||
client.machineLearning().openJobAsync(openJobRequest, RequestOptions.DEFAULT, listener); //<1>
|
||||
// end::x-pack-ml-open-job-execute-async
|
||||
|
||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -22,27 +22,25 @@ package org.elasticsearch.client.documentation;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.LatchedActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotStats;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotStatus;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
@ -163,7 +161,7 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::create-repository-request-verify
|
||||
|
||||
// tag::create-repository-execute
|
||||
PutRepositoryResponse response = client.snapshot().createRepository(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.snapshot().createRepository(request, RequestOptions.DEFAULT);
|
||||
// end::create-repository-execute
|
||||
|
||||
// tag::create-repository-response
|
||||
@ -178,10 +176,10 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
PutRepositoryRequest request = new PutRepositoryRequest(repositoryName);
|
||||
|
||||
// tag::create-repository-execute-listener
|
||||
ActionListener<PutRepositoryResponse> listener =
|
||||
new ActionListener<PutRepositoryResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutRepositoryResponse putRepositoryResponse) {
|
||||
public void onResponse(AcknowledgedResponse putRepositoryResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -388,7 +386,7 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::delete-repository-request-timeout
|
||||
|
||||
// tag::delete-repository-execute
|
||||
DeleteRepositoryResponse response = client.snapshot().deleteRepository(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.snapshot().deleteRepository(request, RequestOptions.DEFAULT);
|
||||
// end::delete-repository-execute
|
||||
|
||||
// tag::delete-repository-response
|
||||
@ -403,10 +401,10 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
DeleteRepositoryRequest request = new DeleteRepositoryRequest();
|
||||
|
||||
// tag::delete-repository-execute-listener
|
||||
ActionListener<DeleteRepositoryResponse> listener =
|
||||
new ActionListener<DeleteRepositoryResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteRepositoryResponse deleteRepositoryResponse) {
|
||||
public void onResponse(AcknowledgedResponse deleteRepositoryResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
@ -752,7 +750,7 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::delete-snapshot-request-masterTimeout
|
||||
|
||||
// tag::delete-snapshot-execute
|
||||
DeleteSnapshotResponse response = client.snapshot().delete(request, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse response = client.snapshot().delete(request, RequestOptions.DEFAULT);
|
||||
// end::delete-snapshot-execute
|
||||
|
||||
// tag::delete-snapshot-response
|
||||
@ -767,10 +765,10 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
DeleteSnapshotRequest request = new DeleteSnapshotRequest();
|
||||
|
||||
// tag::delete-snapshot-execute-listener
|
||||
ActionListener<DeleteSnapshotResponse> listener =
|
||||
new ActionListener<DeleteSnapshotResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteSnapshotResponse deleteSnapshotResponse) {
|
||||
public void onResponse(AcknowledgedResponse deleteSnapshotResponse) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ import org.apache.http.util.EntityUtils;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.LatchedActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.Response;
|
||||
@ -154,7 +154,7 @@ public class StoredScriptsDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::delete-stored-script-request-timeout
|
||||
|
||||
// tag::delete-stored-script-execute
|
||||
DeleteStoredScriptResponse deleteResponse = client.deleteScript(deleteRequest, RequestOptions.DEFAULT);
|
||||
AcknowledgedResponse deleteResponse = client.deleteScript(deleteRequest, RequestOptions.DEFAULT);
|
||||
// end::delete-stored-script-execute
|
||||
|
||||
// tag::delete-stored-script-response
|
||||
@ -164,10 +164,10 @@ public class StoredScriptsDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
putStoredScript("calculate-score", scriptSource);
|
||||
|
||||
// tag::delete-stored-script-execute-listener
|
||||
ActionListener<DeleteStoredScriptResponse> listener =
|
||||
new ActionListener<DeleteStoredScriptResponse>() {
|
||||
ActionListener<AcknowledgedResponse> listener =
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteStoredScriptResponse response) {
|
||||
public void onResponse(AcknowledgedResponse response) {
|
||||
// <1>
|
||||
}
|
||||
|
||||
|
55
docs/java-rest/high-level/ml/open-job.asciidoc
Normal file
55
docs/java-rest/high-level/ml/open-job.asciidoc
Normal file
@ -0,0 +1,55 @@
|
||||
[[java-rest-high-x-pack-ml-open-job]]
|
||||
=== Open Job API
|
||||
|
||||
The Open Job API provides the ability to open {ml} jobs in the cluster.
|
||||
It accepts a `OpenJobRequest` object and responds
|
||||
with a `OpenJobResponse` object.
|
||||
|
||||
[[java-rest-high-x-pack-ml-open-job-request]]
|
||||
==== Open Job Request
|
||||
|
||||
An `OpenJobRequest` object gets created with an existing non-null `jobId`.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-open-job-request]
|
||||
--------------------------------------------------
|
||||
<1> Constructing a new request referencing an existing `jobId`
|
||||
<2> Optionally setting the `timeout` value for how long the
|
||||
execution should wait for the job to be opened.
|
||||
|
||||
[[java-rest-high-x-pack-ml-open-job-execution]]
|
||||
==== Execution
|
||||
|
||||
The request can be executed through the `MachineLearningClient` contained
|
||||
in the `RestHighLevelClient` object, accessed via the `machineLearningClient()` method.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-open-job-execute]
|
||||
--------------------------------------------------
|
||||
<1> `isOpened()` from the `OpenJobResponse` indicates if the job was successfully
|
||||
opened or not.
|
||||
|
||||
[[java-rest-high-x-pack-ml-open-job-execution-async]]
|
||||
==== Asynchronous Execution
|
||||
|
||||
The request can also be executed asynchronously:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-open-job-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `OpenJobRequest` to execute and the `ActionListener` to use when
|
||||
the execution completes
|
||||
|
||||
The method does not block and returns immediately. The passed `ActionListener` is used
|
||||
to notify the caller of completion. A typical `ActionListner` for `OpenJobResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-open-job-listener]
|
||||
--------------------------------------------------
|
||||
<1> `onResponse` is called back when the action is completed successfully
|
||||
<2> `onFailure` is called back when some unexpected error occurs
|
@ -205,8 +205,10 @@ include::licensing/delete-license.asciidoc[]
|
||||
The Java High Level REST Client supports the following Machine Learning APIs:
|
||||
|
||||
* <<java-rest-high-x-pack-ml-put-job>>
|
||||
* <<java-rest-high-x-pack-ml-open-job>>
|
||||
|
||||
include::ml/put_job.asciidoc[]
|
||||
include::ml/put-job.asciidoc[]
|
||||
include::ml/open-job.asciidoc[]
|
||||
|
||||
== Migration APIs
|
||||
|
||||
|
@ -100,6 +100,6 @@ public class AppendProcessorFactoryTests extends ESTestCase {
|
||||
String processorTag = randomAlphaOfLength(10);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config));
|
||||
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
|
||||
assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag));
|
||||
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
|
||||
}
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ public class ConvertProcessorFactoryTests extends ESTestCase {
|
||||
fail("factory create should have failed");
|
||||
} catch (ElasticsearchParseException e) {
|
||||
assertThat(e.getMessage(), Matchers.equalTo("[type] type [" + type + "] not supported, cannot convert field."));
|
||||
assertThat(e.getHeader("processor_type").get(0), equalTo(ConvertProcessor.TYPE));
|
||||
assertThat(e.getHeader("property_name").get(0), equalTo("type"));
|
||||
assertThat(e.getHeader("processor_tag"), nullValue());
|
||||
assertThat(e.getMetadata("es.processor_type").get(0), equalTo(ConvertProcessor.TYPE));
|
||||
assertThat(e.getMetadata("es.property_name").get(0), equalTo("type"));
|
||||
assertThat(e.getMetadata("es.processor_tag"), nullValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,6 @@ public class FailProcessorFactoryTests extends ESTestCase {
|
||||
String processorTag = randomAlphaOfLength(10);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config));
|
||||
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
|
||||
assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag));
|
||||
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,6 @@ public class RemoveProcessorFactoryTests extends ESTestCase {
|
||||
String processorTag = randomAlphaOfLength(10);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config));
|
||||
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
|
||||
assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag));
|
||||
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class SetProcessorFactoryTests extends ESTestCase {
|
||||
String processorTag = randomAlphaOfLength(10);
|
||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config));
|
||||
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
|
||||
assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag));
|
||||
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -158,9 +158,9 @@ teardown:
|
||||
}
|
||||
- match: { error.root_cause.0.type: "parse_exception" }
|
||||
- match: { error.root_cause.0.reason: "[field] required property is missing" }
|
||||
- match: { error.root_cause.0.header.processor_tag: "fritag" }
|
||||
- match: { error.root_cause.0.header.processor_type: "set" }
|
||||
- match: { error.root_cause.0.header.property_name: "field" }
|
||||
- match: { error.root_cause.0.processor_tag: "fritag" }
|
||||
- match: { error.root_cause.0.processor_type: "set" }
|
||||
- match: { error.root_cause.0.property_name: "field" }
|
||||
|
||||
---
|
||||
"Test basic pipeline with on_failure in processor":
|
||||
|
@ -148,9 +148,9 @@ teardown:
|
||||
}
|
||||
- match: { error.root_cause.0.type: "parse_exception" }
|
||||
- match: { error.root_cause.0.reason: "[on_failure] processors list cannot be empty" }
|
||||
- match: { error.root_cause.0.header.processor_type: "fail" }
|
||||
- match: { error.root_cause.0.header.processor_tag: "emptyfail" }
|
||||
- match: { error.root_cause.0.header.property_name: "on_failure" }
|
||||
- match: { error.root_cause.0.processor_type: "fail" }
|
||||
- match: { error.root_cause.0.processor_tag: "emptyfail" }
|
||||
- match: { error.root_cause.0.property_name: "on_failure" }
|
||||
|
||||
---
|
||||
"Test pipeline with empty on_failure in pipeline":
|
||||
|
@ -107,9 +107,9 @@ teardown:
|
||||
}
|
||||
- match: { error.root_cause.0.type: "parse_exception" }
|
||||
- match: { error.root_cause.0.reason: "[field] required property is missing" }
|
||||
- match: { error.root_cause.0.header.processor_tag: "fails" }
|
||||
- match: { error.root_cause.0.header.processor_type: "set" }
|
||||
- match: { error.root_cause.0.header.property_name: "field" }
|
||||
- match: { error.root_cause.0.processor_tag: "fails" }
|
||||
- match: { error.root_cause.0.processor_type: "set" }
|
||||
- match: { error.root_cause.0.property_name: "field" }
|
||||
|
||||
---
|
||||
"Test simulate without index type and id":
|
||||
@ -198,9 +198,9 @@ teardown:
|
||||
}
|
||||
]
|
||||
}
|
||||
- is_false: error.root_cause.0.header.processor_type
|
||||
- is_false: error.root_cause.0.header.processor_tag
|
||||
- match: { error.root_cause.0.header.property_name: "pipeline" }
|
||||
- is_false: error.root_cause.0.processor_type
|
||||
- is_false: error.root_cause.0.processor_tag
|
||||
- match: { error.root_cause.0.property_name: "pipeline" }
|
||||
- match: { error.reason: "[pipeline] required property is missing" }
|
||||
|
||||
---
|
||||
@ -233,9 +233,9 @@ teardown:
|
||||
}
|
||||
- match: { error.root_cause.0.type: "parse_exception" }
|
||||
- match: { error.root_cause.0.reason: "[value] required property is missing" }
|
||||
- match: { error.root_cause.0.header.processor_type: "set" }
|
||||
- match: { error.root_cause.0.header.property_name: "value" }
|
||||
- is_false: error.root_cause.0.header.processor_tag
|
||||
- match: { error.root_cause.0.processor_type: "set" }
|
||||
- match: { error.root_cause.0.property_name: "value" }
|
||||
- is_false: error.root_cause.0.processor_tag
|
||||
|
||||
---
|
||||
"Test simulate with verbose flag":
|
||||
|
@ -20,9 +20,9 @@
|
||||
package org.elasticsearch.repositories.url;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
@ -120,7 +120,7 @@ public class URLSnapshotRestoreTests extends ESIntegTestCase {
|
||||
assertThat(getSnapshotsResponse.getSnapshots().size(), equalTo(1));
|
||||
|
||||
logger.info("--> delete snapshot");
|
||||
DeleteSnapshotResponse deleteSnapshotResponse = client.admin().cluster().prepareDeleteSnapshot("test-repo", "test-snap").get();
|
||||
AcknowledgedResponse deleteSnapshotResponse = client.admin().cluster().prepareDeleteSnapshot("test-repo", "test-snap").get();
|
||||
assertAcked(deleteSnapshotResponse);
|
||||
|
||||
logger.info("--> list available shapshot again, no snapshots should be returned");
|
||||
|
@ -54,7 +54,6 @@ import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TcpTransport;
|
||||
import org.elasticsearch.transport.TransportRequestOptions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
@ -147,7 +146,6 @@ public class Netty4Transport extends TcpTransport {
|
||||
|
||||
bootstrap.handler(getClientChannelInitializer());
|
||||
|
||||
bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Math.toIntExact(defaultConnectionProfile.getConnectTimeout().millis()));
|
||||
bootstrap.option(ChannelOption.TCP_NODELAY, TCP_NO_DELAY.get(settings));
|
||||
bootstrap.option(ChannelOption.SO_KEEPALIVE, TCP_KEEP_ALIVE.get(settings));
|
||||
|
||||
@ -175,14 +173,8 @@ public class Netty4Transport extends TcpTransport {
|
||||
String name = profileSettings.profileName;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("using profile[{}], worker_count[{}], port[{}], bind_host[{}], publish_host[{}], compress[{}], "
|
||||
+ "connect_timeout[{}], connections_per_node[{}/{}/{}/{}/{}], receive_predictor[{}->{}]",
|
||||
+ "receive_predictor[{}->{}]",
|
||||
name, workerCount, profileSettings.portOrRange, profileSettings.bindHosts, profileSettings.publishHosts, compress,
|
||||
defaultConnectionProfile.getConnectTimeout(),
|
||||
defaultConnectionProfile.getNumConnectionsPerType(TransportRequestOptions.Type.RECOVERY),
|
||||
defaultConnectionProfile.getNumConnectionsPerType(TransportRequestOptions.Type.BULK),
|
||||
defaultConnectionProfile.getNumConnectionsPerType(TransportRequestOptions.Type.REG),
|
||||
defaultConnectionProfile.getNumConnectionsPerType(TransportRequestOptions.Type.STATE),
|
||||
defaultConnectionProfile.getNumConnectionsPerType(TransportRequestOptions.Type.PING),
|
||||
receivePredictorMin, receivePredictorMax);
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
package org.elasticsearch.index.mapper.size;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.plugin.mapper.MapperSizePlugin;
|
||||
@ -62,7 +62,7 @@ public class SizeMappingIT extends ESIntegTestCase {
|
||||
XContentBuilder updateMappingBuilder =
|
||||
jsonBuilder().startObject().startObject("properties").startObject("otherField").field("type", "text")
|
||||
.endObject().endObject().endObject();
|
||||
PutMappingResponse putMappingResponse =
|
||||
AcknowledgedResponse putMappingResponse =
|
||||
client().admin().indices().preparePutMapping(index).setType(type).setSource(updateMappingBuilder).get();
|
||||
assertAcked(putMappingResponse);
|
||||
|
||||
@ -84,7 +84,7 @@ public class SizeMappingIT extends ESIntegTestCase {
|
||||
// update some field in the mapping
|
||||
XContentBuilder updateMappingBuilder =
|
||||
jsonBuilder().startObject().startObject("_size").field("enabled", false).endObject().endObject();
|
||||
PutMappingResponse putMappingResponse =
|
||||
AcknowledgedResponse putMappingResponse =
|
||||
client().admin().indices().preparePutMapping(index).setType(type).setSource(updateMappingBuilder).get();
|
||||
assertAcked(putMappingResponse);
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
package org.elasticsearch.repositories.hdfs;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.bootstrap.JavaVersion;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
@ -48,7 +48,7 @@ public class HdfsTests extends ESSingleNodeTestCase {
|
||||
assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", JavaVersion.current().equals(JavaVersion.parse("11")));
|
||||
Client client = client();
|
||||
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("hdfs")
|
||||
.setSettings(Settings.builder()
|
||||
.put("uri", "hdfs:///")
|
||||
|
@ -347,6 +347,6 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
- match: { error.header.processor_type: "set" }
|
||||
- match: { error.processor_type: "set" }
|
||||
- match: { error.type: "script_exception" }
|
||||
- match: { error.reason: "Mustache function [join] must contain one and only one identifier" }
|
||||
|
@ -103,7 +103,7 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
- match: { error.header.processor_type: "script" }
|
||||
- match: { error.processor_type: "script" }
|
||||
- match: { error.type: "script_exception" }
|
||||
- match: { error.reason: "compile error" }
|
||||
|
||||
|
@ -20,11 +20,12 @@
|
||||
package org.elasticsearch.action.admin.cluster.repositories.delete;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
/**
|
||||
* Unregister repository action
|
||||
*/
|
||||
public class DeleteRepositoryAction extends Action<DeleteRepositoryResponse> {
|
||||
public class DeleteRepositoryAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final DeleteRepositoryAction INSTANCE = new DeleteRepositoryAction();
|
||||
public static final String NAME = "cluster:admin/repository/delete";
|
||||
@ -34,8 +35,8 @@ public class DeleteRepositoryAction extends Action<DeleteRepositoryResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeleteRepositoryResponse newResponse() {
|
||||
return new DeleteRepositoryResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,13 @@
|
||||
package org.elasticsearch.action.admin.cluster.repositories.delete;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
/**
|
||||
* Builder for unregister repository request
|
||||
*/
|
||||
public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> {
|
||||
public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, AcknowledgedResponse, DeleteRepositoryRequestBuilder> {
|
||||
|
||||
/**
|
||||
* Constructs unregister repository request builder
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.cluster.repositories.delete;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -37,7 +38,7 @@ import org.elasticsearch.transport.TransportService;
|
||||
/**
|
||||
* Transport action for unregister repository operation
|
||||
*/
|
||||
public class TransportDeleteRepositoryAction extends TransportMasterNodeAction<DeleteRepositoryRequest, DeleteRepositoryResponse> {
|
||||
public class TransportDeleteRepositoryAction extends TransportMasterNodeAction<DeleteRepositoryRequest, AcknowledgedResponse> {
|
||||
|
||||
private final RepositoriesService repositoriesService;
|
||||
|
||||
@ -55,8 +56,8 @@ public class TransportDeleteRepositoryAction extends TransportMasterNodeAction<D
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteRepositoryResponse newResponse() {
|
||||
return new DeleteRepositoryResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,14 +66,14 @@ public class TransportDeleteRepositoryAction extends TransportMasterNodeAction<D
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final DeleteRepositoryRequest request, ClusterState state, final ActionListener<DeleteRepositoryResponse> listener) {
|
||||
protected void masterOperation(final DeleteRepositoryRequest request, ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
repositoriesService.unregisterRepository(
|
||||
new RepositoriesService.UnregisterRepositoryRequest("delete_repository [" + request.name() + "]", request.name())
|
||||
.masterNodeTimeout(request.masterNodeTimeout()).ackTimeout(request.timeout()),
|
||||
new ActionListener<ClusterStateUpdateResponse>() {
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse unregisterRepositoryResponse) {
|
||||
listener.onResponse(new DeleteRepositoryResponse(unregisterRepositoryResponse.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(unregisterRepositoryResponse.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,11 +20,12 @@
|
||||
package org.elasticsearch.action.admin.cluster.repositories.put;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
/**
|
||||
* Register repository action
|
||||
*/
|
||||
public class PutRepositoryAction extends Action<PutRepositoryResponse> {
|
||||
public class PutRepositoryAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final PutRepositoryAction INSTANCE = new PutRepositoryAction();
|
||||
public static final String NAME = "cluster:admin/repository/put";
|
||||
@ -34,8 +35,8 @@ public class PutRepositoryAction extends Action<PutRepositoryResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutRepositoryResponse newResponse() {
|
||||
return new PutRepositoryResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package org.elasticsearch.action.admin.cluster.repositories.put;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
@ -29,7 +30,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Register repository request builder
|
||||
*/
|
||||
public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> {
|
||||
public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, AcknowledgedResponse, PutRepositoryRequestBuilder> {
|
||||
|
||||
/**
|
||||
* Constructs register repository request
|
||||
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.repositories.put;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* Register repository response
|
||||
*/
|
||||
public class PutRepositoryResponse extends AcknowledgedResponse {
|
||||
|
||||
PutRepositoryResponse() {
|
||||
}
|
||||
|
||||
PutRepositoryResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static PutRepositoryResponse fromXContent(XContentParser parser) {
|
||||
return new PutRepositoryResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.cluster.repositories.put;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -37,7 +38,7 @@ import org.elasticsearch.transport.TransportService;
|
||||
/**
|
||||
* Transport action for register repository operation
|
||||
*/
|
||||
public class TransportPutRepositoryAction extends TransportMasterNodeAction<PutRepositoryRequest, PutRepositoryResponse> {
|
||||
public class TransportPutRepositoryAction extends TransportMasterNodeAction<PutRepositoryRequest, AcknowledgedResponse> {
|
||||
|
||||
private final RepositoriesService repositoriesService;
|
||||
|
||||
@ -55,8 +56,8 @@ public class TransportPutRepositoryAction extends TransportMasterNodeAction<PutR
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PutRepositoryResponse newResponse() {
|
||||
return new PutRepositoryResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,7 +66,7 @@ public class TransportPutRepositoryAction extends TransportMasterNodeAction<PutR
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final PutRepositoryRequest request, ClusterState state, final ActionListener<PutRepositoryResponse> listener) {
|
||||
protected void masterOperation(final PutRepositoryRequest request, ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
|
||||
repositoriesService.registerRepository(
|
||||
new RepositoriesService.RegisterRepositoryRequest("put_repository [" + request.name() + "]",
|
||||
@ -76,7 +77,7 @@ public class TransportPutRepositoryAction extends TransportMasterNodeAction<PutR
|
||||
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse response) {
|
||||
listener.onResponse(new PutRepositoryResponse(response.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,11 +20,12 @@
|
||||
package org.elasticsearch.action.admin.cluster.snapshots.delete;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
/**
|
||||
* Delete snapshot action
|
||||
*/
|
||||
public class DeleteSnapshotAction extends Action<DeleteSnapshotResponse> {
|
||||
public class DeleteSnapshotAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final DeleteSnapshotAction INSTANCE = new DeleteSnapshotAction();
|
||||
public static final String NAME = "cluster:admin/snapshot/delete";
|
||||
@ -34,8 +35,8 @@ public class DeleteSnapshotAction extends Action<DeleteSnapshotResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeleteSnapshotResponse newResponse() {
|
||||
return new DeleteSnapshotResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,13 +19,14 @@
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.snapshots.delete;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
/**
|
||||
* Delete snapshot request builder
|
||||
*/
|
||||
public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> {
|
||||
public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, AcknowledgedResponse, DeleteSnapshotRequestBuilder> {
|
||||
|
||||
/**
|
||||
* Constructs delete snapshot request builder
|
||||
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.snapshots.delete;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* Delete snapshot response
|
||||
*/
|
||||
public class DeleteSnapshotResponse extends AcknowledgedResponse {
|
||||
|
||||
DeleteSnapshotResponse() {
|
||||
}
|
||||
|
||||
DeleteSnapshotResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static DeleteSnapshotResponse fromXContent(XContentParser parser) {
|
||||
return new DeleteSnapshotResponse(parseAcknowledged(parser));
|
||||
}
|
||||
|
||||
}
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.cluster.snapshots.delete;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
@ -36,7 +37,7 @@ import org.elasticsearch.transport.TransportService;
|
||||
/**
|
||||
* Transport action for delete snapshot operation
|
||||
*/
|
||||
public class TransportDeleteSnapshotAction extends TransportMasterNodeAction<DeleteSnapshotRequest, DeleteSnapshotResponse> {
|
||||
public class TransportDeleteSnapshotAction extends TransportMasterNodeAction<DeleteSnapshotRequest, AcknowledgedResponse> {
|
||||
private final SnapshotsService snapshotsService;
|
||||
|
||||
@Inject
|
||||
@ -53,8 +54,8 @@ public class TransportDeleteSnapshotAction extends TransportMasterNodeAction<Del
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteSnapshotResponse newResponse() {
|
||||
return new DeleteSnapshotResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,11 +65,11 @@ public class TransportDeleteSnapshotAction extends TransportMasterNodeAction<Del
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final DeleteSnapshotRequest request, ClusterState state, final ActionListener<DeleteSnapshotResponse> listener) {
|
||||
protected void masterOperation(final DeleteSnapshotRequest request, ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
snapshotsService.deleteSnapshot(request.repository(), request.snapshot(), new SnapshotsService.DeleteSnapshotListener() {
|
||||
@Override
|
||||
public void onResponse() {
|
||||
listener.onResponse(new DeleteSnapshotResponse(true));
|
||||
listener.onResponse(new AcknowledgedResponse(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class DeleteStoredScriptAction extends Action<DeleteStoredScriptResponse> {
|
||||
public class DeleteStoredScriptAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final DeleteStoredScriptAction INSTANCE = new DeleteStoredScriptAction();
|
||||
public static final String NAME = "cluster:admin/script/delete";
|
||||
@ -31,7 +32,7 @@ public class DeleteStoredScriptAction extends Action<DeleteStoredScriptResponse>
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeleteStoredScriptResponse newResponse() {
|
||||
return new DeleteStoredScriptResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,11 @@
|
||||
package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
public class DeleteStoredScriptRequestBuilder extends AcknowledgedRequestBuilder<DeleteStoredScriptRequest,
|
||||
DeleteStoredScriptResponse, DeleteStoredScriptRequestBuilder> {
|
||||
AcknowledgedResponse, DeleteStoredScriptRequestBuilder> {
|
||||
|
||||
public DeleteStoredScriptRequestBuilder(ElasticsearchClient client, DeleteStoredScriptAction action) {
|
||||
super(client, action, new DeleteStoredScriptRequest());
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
public class DeleteStoredScriptResponse extends AcknowledgedResponse {
|
||||
|
||||
DeleteStoredScriptResponse() {
|
||||
}
|
||||
|
||||
public DeleteStoredScriptResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static DeleteStoredScriptResponse fromXContent(XContentParser parser) {
|
||||
return new DeleteStoredScriptResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -20,9 +20,10 @@
|
||||
package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
|
||||
public class PutStoredScriptAction extends Action<PutStoredScriptResponse> {
|
||||
public class PutStoredScriptAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final PutStoredScriptAction INSTANCE = new PutStoredScriptAction();
|
||||
public static final String NAME = "cluster:admin/script/put";
|
||||
@ -34,7 +35,7 @@ public class PutStoredScriptAction extends Action<PutStoredScriptResponse> {
|
||||
|
||||
|
||||
@Override
|
||||
public PutStoredScriptResponse newResponse() {
|
||||
return new PutStoredScriptResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -20,12 +20,13 @@
|
||||
package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
|
||||
public class PutStoredScriptRequestBuilder extends AcknowledgedRequestBuilder<PutStoredScriptRequest,
|
||||
PutStoredScriptResponse, PutStoredScriptRequestBuilder> {
|
||||
AcknowledgedResponse, PutStoredScriptRequestBuilder> {
|
||||
|
||||
public PutStoredScriptRequestBuilder(ElasticsearchClient client, PutStoredScriptAction action) {
|
||||
super(client, action, new PutStoredScriptRequest());
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class PutStoredScriptResponse extends AcknowledgedResponse {
|
||||
|
||||
PutStoredScriptResponse() {
|
||||
}
|
||||
|
||||
public PutStoredScriptResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
}
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
@ -33,8 +34,7 @@ import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportDeleteStoredScriptAction extends TransportMasterNodeAction<DeleteStoredScriptRequest,
|
||||
DeleteStoredScriptResponse> {
|
||||
public class TransportDeleteStoredScriptAction extends TransportMasterNodeAction<DeleteStoredScriptRequest, AcknowledgedResponse> {
|
||||
|
||||
private final ScriptService scriptService;
|
||||
|
||||
@ -53,13 +53,13 @@ public class TransportDeleteStoredScriptAction extends TransportMasterNodeAction
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteStoredScriptResponse newResponse() {
|
||||
return new DeleteStoredScriptResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(DeleteStoredScriptRequest request, ClusterState state,
|
||||
ActionListener<DeleteStoredScriptResponse> listener) throws Exception {
|
||||
ActionListener<AcknowledgedResponse> listener) throws Exception {
|
||||
scriptService.deleteStoredScript(clusterService, request, listener);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
@ -33,7 +34,7 @@ import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportPutStoredScriptAction extends TransportMasterNodeAction<PutStoredScriptRequest, PutStoredScriptResponse> {
|
||||
public class TransportPutStoredScriptAction extends TransportMasterNodeAction<PutStoredScriptRequest, AcknowledgedResponse> {
|
||||
|
||||
private final ScriptService scriptService;
|
||||
|
||||
@ -52,13 +53,13 @@ public class TransportPutStoredScriptAction extends TransportMasterNodeAction<Pu
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PutStoredScriptResponse newResponse() {
|
||||
return new PutStoredScriptResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(PutStoredScriptRequest request, ClusterState state,
|
||||
ActionListener<PutStoredScriptResponse> listener) throws Exception {
|
||||
ActionListener<AcknowledgedResponse> listener) throws Exception {
|
||||
scriptService.putStoredScript(clusterService, request, listener);
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.alias;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class IndicesAliasesAction extends Action<IndicesAliasesResponse> {
|
||||
public class IndicesAliasesAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final IndicesAliasesAction INSTANCE = new IndicesAliasesAction();
|
||||
public static final String NAME = "indices:admin/aliases";
|
||||
@ -31,7 +32,7 @@ public class IndicesAliasesAction extends Action<IndicesAliasesResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndicesAliasesResponse newResponse() {
|
||||
return new IndicesAliasesResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.indices.alias;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
|
||||
@ -30,7 +31,7 @@ import java.util.Map;
|
||||
* Builder for request to modify many aliases at once.
|
||||
*/
|
||||
public class IndicesAliasesRequestBuilder
|
||||
extends AcknowledgedRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> {
|
||||
extends AcknowledgedRequestBuilder<IndicesAliasesRequest, AcknowledgedResponse, IndicesAliasesRequestBuilder> {
|
||||
|
||||
public IndicesAliasesRequestBuilder(ElasticsearchClient client, IndicesAliasesAction action) {
|
||||
super(client, action, new IndicesAliasesRequest());
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.alias;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* A response for a add/remove alias action.
|
||||
*/
|
||||
public class IndicesAliasesResponse extends AcknowledgedResponse {
|
||||
|
||||
private static final ConstructingObjectParser<IndicesAliasesResponse, Void> PARSER = new ConstructingObjectParser<>("indices_aliases",
|
||||
true, args -> new IndicesAliasesResponse((boolean) args[0]));
|
||||
static {
|
||||
declareAcknowledgedField(PARSER);
|
||||
}
|
||||
|
||||
IndicesAliasesResponse() {
|
||||
}
|
||||
|
||||
public IndicesAliasesResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static IndicesAliasesResponse fromXContent(XContentParser parser) {
|
||||
return new IndicesAliasesResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectCursor;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -52,7 +53,7 @@ import static java.util.Collections.unmodifiableList;
|
||||
/**
|
||||
* Add/remove aliases action
|
||||
*/
|
||||
public class TransportIndicesAliasesAction extends TransportMasterNodeAction<IndicesAliasesRequest, IndicesAliasesResponse> {
|
||||
public class TransportIndicesAliasesAction extends TransportMasterNodeAction<IndicesAliasesRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataIndexAliasesService indexAliasesService;
|
||||
|
||||
@ -71,8 +72,8 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeAction<Ind
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IndicesAliasesResponse newResponse() {
|
||||
return new IndicesAliasesResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -85,7 +86,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeAction<Ind
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final IndicesAliasesRequest request, final ClusterState state, final ActionListener<IndicesAliasesResponse> listener) {
|
||||
protected void masterOperation(final IndicesAliasesRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
|
||||
//Expand the indices names
|
||||
List<AliasActions> actions = request.aliasActions();
|
||||
@ -127,7 +128,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeAction<Ind
|
||||
indexAliasesService.indicesAliases(updateRequest, new ActionListener<ClusterStateUpdateResponse>() {
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse response) {
|
||||
listener.onResponse(new IndicesAliasesResponse(response.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.close;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class CloseIndexAction extends Action<CloseIndexResponse> {
|
||||
public class CloseIndexAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final CloseIndexAction INSTANCE = new CloseIndexAction();
|
||||
public static final String NAME = "indices:admin/close";
|
||||
@ -31,7 +32,7 @@ public class CloseIndexAction extends Action<CloseIndexResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseIndexResponse newResponse() {
|
||||
return new CloseIndexResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -21,12 +21,14 @@ package org.elasticsearch.action.admin.indices.close;
|
||||
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
/**
|
||||
* Builder for close index request
|
||||
*/
|
||||
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
|
||||
public class CloseIndexRequestBuilder
|
||||
extends AcknowledgedRequestBuilder<CloseIndexRequest, AcknowledgedResponse, CloseIndexRequestBuilder> {
|
||||
|
||||
public CloseIndexRequestBuilder(ElasticsearchClient client, CloseIndexAction action) {
|
||||
super(client, action, new CloseIndexRequest());
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.close;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* A response for a close index action.
|
||||
*/
|
||||
public class CloseIndexResponse extends AcknowledgedResponse {
|
||||
CloseIndexResponse() {
|
||||
}
|
||||
|
||||
CloseIndexResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static CloseIndexResponse fromXContent(XContentParser parser) {
|
||||
return new CloseIndexResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.DestructiveOperations;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -44,7 +45,7 @@ import org.elasticsearch.transport.TransportService;
|
||||
/**
|
||||
* Close index action
|
||||
*/
|
||||
public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIndexRequest, CloseIndexResponse> {
|
||||
public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIndexRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataIndexStateService indexStateService;
|
||||
private final DestructiveOperations destructiveOperations;
|
||||
@ -75,12 +76,12 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIn
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CloseIndexResponse newResponse() {
|
||||
return new CloseIndexResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, CloseIndexRequest request, ActionListener<CloseIndexResponse> listener) {
|
||||
protected void doExecute(Task task, CloseIndexRequest request, ActionListener<AcknowledgedResponse> listener) {
|
||||
destructiveOperations.failDestructive(request.indices());
|
||||
if (closeIndexEnabled == false) {
|
||||
throw new IllegalStateException("closing indices is disabled - set [" + CLUSTER_INDICES_CLOSE_ENABLE_SETTING.getKey() + ": true] to enable it. NOTE: closed indices still consume a significant amount of diskspace");
|
||||
@ -94,10 +95,10 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIn
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final CloseIndexRequest request, final ClusterState state, final ActionListener<CloseIndexResponse> listener) {
|
||||
protected void masterOperation(final CloseIndexRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request);
|
||||
if (concreteIndices == null || concreteIndices.length == 0) {
|
||||
listener.onResponse(new CloseIndexResponse(true));
|
||||
listener.onResponse(new AcknowledgedResponse(true));
|
||||
return;
|
||||
}
|
||||
CloseIndexClusterStateUpdateRequest updateRequest = new CloseIndexClusterStateUpdateRequest()
|
||||
@ -108,7 +109,7 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIn
|
||||
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse response) {
|
||||
listener.onResponse(new CloseIndexResponse(response.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.delete;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class DeleteIndexAction extends Action<DeleteIndexResponse> {
|
||||
public class DeleteIndexAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final DeleteIndexAction INSTANCE = new DeleteIndexAction();
|
||||
public static final String NAME = "indices:admin/delete";
|
||||
@ -31,7 +32,7 @@ public class DeleteIndexAction extends Action<DeleteIndexResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeleteIndexResponse newResponse() {
|
||||
return new DeleteIndexResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,10 @@ package org.elasticsearch.action.admin.indices.delete;
|
||||
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
public class DeleteIndexRequestBuilder extends AcknowledgedRequestBuilder<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> {
|
||||
public class DeleteIndexRequestBuilder extends AcknowledgedRequestBuilder<DeleteIndexRequest, AcknowledgedResponse, DeleteIndexRequestBuilder> {
|
||||
|
||||
public DeleteIndexRequestBuilder(ElasticsearchClient client, DeleteIndexAction action, String... indices) {
|
||||
super(client, action, new DeleteIndexRequest(indices));
|
||||
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.delete;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* A response for a delete index action.
|
||||
*/
|
||||
public class DeleteIndexResponse extends AcknowledgedResponse {
|
||||
|
||||
DeleteIndexResponse() {
|
||||
}
|
||||
|
||||
DeleteIndexResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static DeleteIndexResponse fromXContent(XContentParser parser) {
|
||||
return new DeleteIndexResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.DestructiveOperations;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -44,7 +45,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Delete index action.
|
||||
*/
|
||||
public class TransportDeleteIndexAction extends TransportMasterNodeAction<DeleteIndexRequest, DeleteIndexResponse> {
|
||||
public class TransportDeleteIndexAction extends TransportMasterNodeAction<DeleteIndexRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataDeleteIndexService deleteIndexService;
|
||||
private final DestructiveOperations destructiveOperations;
|
||||
@ -64,12 +65,12 @@ public class TransportDeleteIndexAction extends TransportMasterNodeAction<Delete
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteIndexResponse newResponse() {
|
||||
return new DeleteIndexResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener) {
|
||||
protected void doExecute(Task task, DeleteIndexRequest request, ActionListener<AcknowledgedResponse> listener) {
|
||||
destructiveOperations.failDestructive(request.indices());
|
||||
super.doExecute(task, request, listener);
|
||||
}
|
||||
@ -80,10 +81,10 @@ public class TransportDeleteIndexAction extends TransportMasterNodeAction<Delete
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final DeleteIndexRequest request, final ClusterState state, final ActionListener<DeleteIndexResponse> listener) {
|
||||
protected void masterOperation(final DeleteIndexRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
final Set<Index> concreteIndices = new HashSet<>(Arrays.asList(indexNameExpressionResolver.concreteIndices(state, request)));
|
||||
if (concreteIndices.isEmpty()) {
|
||||
listener.onResponse(new DeleteIndexResponse(true));
|
||||
listener.onResponse(new AcknowledgedResponse(true));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,7 +96,7 @@ public class TransportDeleteIndexAction extends TransportMasterNodeAction<Delete
|
||||
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse response) {
|
||||
listener.onResponse(new DeleteIndexResponse(response.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.mapping.put;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class PutMappingAction extends Action<PutMappingResponse> {
|
||||
public class PutMappingAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final PutMappingAction INSTANCE = new PutMappingAction();
|
||||
public static final String NAME = "indices:admin/mapping/put";
|
||||
@ -31,7 +32,7 @@ public class PutMappingAction extends Action<PutMappingResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutMappingResponse newResponse() {
|
||||
return new PutMappingResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.IndicesRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
@ -57,7 +58,7 @@ import static org.elasticsearch.action.ValidateActions.addValidationError;
|
||||
*
|
||||
* @see org.elasticsearch.client.Requests#putMappingRequest(String...)
|
||||
* @see org.elasticsearch.client.IndicesAdminClient#putMapping(PutMappingRequest)
|
||||
* @see PutMappingResponse
|
||||
* @see AcknowledgedResponse
|
||||
*/
|
||||
public class PutMappingRequest extends AcknowledgedRequest<PutMappingRequest> implements IndicesRequest.Replaceable, ToXContentObject {
|
||||
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.indices.mapping.put;
|
||||
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
@ -31,7 +32,8 @@ import java.util.Map;
|
||||
/**
|
||||
* Builder for a put mapping request
|
||||
*/
|
||||
public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> {
|
||||
public class PutMappingRequestBuilder
|
||||
extends AcknowledgedRequestBuilder<PutMappingRequest, AcknowledgedResponse, PutMappingRequestBuilder> {
|
||||
|
||||
public PutMappingRequestBuilder(ElasticsearchClient client, PutMappingAction action) {
|
||||
super(client, action, new PutMappingRequest());
|
||||
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.mapping.put;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* The response of put mapping operation.
|
||||
*/
|
||||
public class PutMappingResponse extends AcknowledgedResponse {
|
||||
|
||||
protected PutMappingResponse() {
|
||||
}
|
||||
|
||||
protected PutMappingResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static PutMappingResponse fromXContent(XContentParser parser) {
|
||||
return new PutMappingResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ package org.elasticsearch.action.admin.indices.mapping.put;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -40,7 +41,7 @@ import org.elasticsearch.transport.TransportService;
|
||||
/**
|
||||
* Put mapping action.
|
||||
*/
|
||||
public class TransportPutMappingAction extends TransportMasterNodeAction<PutMappingRequest, PutMappingResponse> {
|
||||
public class TransportPutMappingAction extends TransportMasterNodeAction<PutMappingRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataMappingService metaDataMappingService;
|
||||
|
||||
@ -59,8 +60,8 @@ public class TransportPutMappingAction extends TransportMasterNodeAction<PutMapp
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PutMappingResponse newResponse() {
|
||||
return new PutMappingResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,7 +76,7 @@ public class TransportPutMappingAction extends TransportMasterNodeAction<PutMapp
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final PutMappingRequest request, final ClusterState state, final ActionListener<PutMappingResponse> listener) {
|
||||
protected void masterOperation(final PutMappingRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
try {
|
||||
final Index[] concreteIndices = request.getConcreteIndex() == null ? indexNameExpressionResolver.concreteIndices(state, request) : new Index[] {request.getConcreteIndex()};
|
||||
PutMappingClusterStateUpdateRequest updateRequest = new PutMappingClusterStateUpdateRequest()
|
||||
@ -87,7 +88,7 @@ public class TransportPutMappingAction extends TransportMasterNodeAction<PutMapp
|
||||
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse response) {
|
||||
listener.onResponse(new PutMappingResponse(response.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.action.admin.indices.settings.put;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -37,7 +38,7 @@ import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportUpdateSettingsAction extends TransportMasterNodeAction<UpdateSettingsRequest, UpdateSettingsResponse> {
|
||||
public class TransportUpdateSettingsAction extends TransportMasterNodeAction<UpdateSettingsRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataUpdateSettingsService updateSettingsService;
|
||||
|
||||
@ -71,12 +72,12 @@ public class TransportUpdateSettingsAction extends TransportMasterNodeAction<Upd
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UpdateSettingsResponse newResponse() {
|
||||
return new UpdateSettingsResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final UpdateSettingsRequest request, final ClusterState state, final ActionListener<UpdateSettingsResponse> listener) {
|
||||
protected void masterOperation(final UpdateSettingsRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request);
|
||||
UpdateSettingsClusterStateUpdateRequest clusterStateUpdateRequest = new UpdateSettingsClusterStateUpdateRequest()
|
||||
.indices(concreteIndices)
|
||||
@ -88,7 +89,7 @@ public class TransportUpdateSettingsAction extends TransportMasterNodeAction<Upd
|
||||
updateSettingsService.updateSettings(clusterStateUpdateRequest, new ActionListener<ClusterStateUpdateResponse>() {
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse response) {
|
||||
listener.onResponse(new UpdateSettingsResponse(response.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.settings.put;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class UpdateSettingsAction extends Action<UpdateSettingsResponse> {
|
||||
public class UpdateSettingsAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final UpdateSettingsAction INSTANCE = new UpdateSettingsAction();
|
||||
public static final String NAME = "indices:admin/settings/update";
|
||||
@ -31,7 +32,7 @@ public class UpdateSettingsAction extends Action<UpdateSettingsResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateSettingsResponse newResponse() {
|
||||
return new UpdateSettingsResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.indices.settings.put;
|
||||
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
@ -30,7 +31,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Builder for an update index settings request
|
||||
*/
|
||||
public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> {
|
||||
public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, AcknowledgedResponse, UpdateSettingsRequestBuilder> {
|
||||
|
||||
public UpdateSettingsRequestBuilder(ElasticsearchClient client, UpdateSettingsAction action, String... indices) {
|
||||
super(client, action, new UpdateSettingsRequest(indices));
|
||||
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.settings.put;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* A response for an update index settings action
|
||||
*/
|
||||
public class UpdateSettingsResponse extends AcknowledgedResponse {
|
||||
|
||||
UpdateSettingsResponse() {
|
||||
}
|
||||
|
||||
public UpdateSettingsResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static UpdateSettingsResponse fromXContent(XContentParser parser) {
|
||||
return new UpdateSettingsResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.template.delete;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class DeleteIndexTemplateAction extends Action<DeleteIndexTemplateResponse> {
|
||||
public class DeleteIndexTemplateAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final DeleteIndexTemplateAction INSTANCE = new DeleteIndexTemplateAction();
|
||||
public static final String NAME = "indices:admin/template/delete";
|
||||
@ -31,7 +32,7 @@ public class DeleteIndexTemplateAction extends Action<DeleteIndexTemplateRespons
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeleteIndexTemplateResponse newResponse() {
|
||||
return new DeleteIndexTemplateResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,11 @@
|
||||
*/
|
||||
package org.elasticsearch.action.admin.indices.template.delete;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> {
|
||||
public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, AcknowledgedResponse, DeleteIndexTemplateRequestBuilder> {
|
||||
|
||||
public DeleteIndexTemplateRequestBuilder(ElasticsearchClient client, DeleteIndexTemplateAction action) {
|
||||
super(client, action, new DeleteIndexTemplateRequest());
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.action.admin.indices.template.delete;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
/**
|
||||
* A response for a delete index template.
|
||||
*/
|
||||
public class DeleteIndexTemplateResponse extends AcknowledgedResponse {
|
||||
|
||||
DeleteIndexTemplateResponse() {
|
||||
}
|
||||
|
||||
protected DeleteIndexTemplateResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.indices.template.delete;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
@ -36,7 +37,7 @@ import org.elasticsearch.transport.TransportService;
|
||||
/**
|
||||
* Delete index action.
|
||||
*/
|
||||
public class TransportDeleteIndexTemplateAction extends TransportMasterNodeAction<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse> {
|
||||
public class TransportDeleteIndexTemplateAction extends TransportMasterNodeAction<DeleteIndexTemplateRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataIndexTemplateService indexTemplateService;
|
||||
|
||||
@ -55,8 +56,8 @@ public class TransportDeleteIndexTemplateAction extends TransportMasterNodeActio
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteIndexTemplateResponse newResponse() {
|
||||
return new DeleteIndexTemplateResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,11 +66,11 @@ public class TransportDeleteIndexTemplateAction extends TransportMasterNodeActio
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final DeleteIndexTemplateRequest request, final ClusterState state, final ActionListener<DeleteIndexTemplateResponse> listener) {
|
||||
protected void masterOperation(final DeleteIndexTemplateRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
indexTemplateService.removeTemplates(new MetaDataIndexTemplateService.RemoveRequest(request.name()).masterTimeout(request.masterNodeTimeout()), new MetaDataIndexTemplateService.RemoveListener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataIndexTemplateService.RemoveResponse response) {
|
||||
listener.onResponse(new DeleteIndexTemplateResponse(response.acknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.acknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.template.put;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class PutIndexTemplateAction extends Action<PutIndexTemplateResponse> {
|
||||
public class PutIndexTemplateAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final PutIndexTemplateAction INSTANCE = new PutIndexTemplateAction();
|
||||
public static final String NAME = "indices:admin/template/put";
|
||||
@ -31,7 +32,7 @@ public class PutIndexTemplateAction extends Action<PutIndexTemplateResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutIndexTemplateResponse newResponse() {
|
||||
return new PutIndexTemplateResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
package org.elasticsearch.action.admin.indices.template.put;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.alias.Alias;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
@ -31,7 +32,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PutIndexTemplateRequestBuilder
|
||||
extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> {
|
||||
extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, AcknowledgedResponse, PutIndexTemplateRequestBuilder> {
|
||||
|
||||
public PutIndexTemplateRequestBuilder(ElasticsearchClient client, PutIndexTemplateAction action) {
|
||||
super(client, action, new PutIndexTemplateRequest());
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.action.admin.indices.template.put;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
||||
/**
|
||||
* A response for a put index template action.
|
||||
*/
|
||||
public class PutIndexTemplateResponse extends AcknowledgedResponse {
|
||||
|
||||
protected PutIndexTemplateResponse() {
|
||||
}
|
||||
|
||||
protected PutIndexTemplateResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
|
||||
public static PutIndexTemplateResponse fromXContent(XContentParser parser) {
|
||||
return new PutIndexTemplateResponse(parseAcknowledged(parser));
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.indices.template.put;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
@ -38,7 +39,7 @@ import org.elasticsearch.transport.TransportService;
|
||||
/**
|
||||
* Put index template action.
|
||||
*/
|
||||
public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<PutIndexTemplateRequest, PutIndexTemplateResponse> {
|
||||
public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<PutIndexTemplateRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataIndexTemplateService indexTemplateService;
|
||||
private final IndexScopedSettings indexScopedSettings;
|
||||
@ -59,8 +60,8 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<P
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PutIndexTemplateResponse newResponse() {
|
||||
return new PutIndexTemplateResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,7 +70,7 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<P
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final PutIndexTemplateRequest request, final ClusterState state, final ActionListener<PutIndexTemplateResponse> listener) {
|
||||
protected void masterOperation(final PutIndexTemplateRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
String cause = request.cause();
|
||||
if (cause.length() == 0) {
|
||||
cause = "api";
|
||||
@ -91,7 +92,7 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<P
|
||||
new MetaDataIndexTemplateService.PutListener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataIndexTemplateService.PutResponse response) {
|
||||
listener.onResponse(new PutIndexTemplateResponse(response.acknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.acknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.PrimaryMissingActionException;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
|
||||
import org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
@ -205,9 +206,9 @@ public class TransportUpgradeAction extends TransportBroadcastByNodeAction<Upgra
|
||||
|
||||
private void updateSettings(final UpgradeResponse upgradeResponse, final ActionListener<UpgradeResponse> listener) {
|
||||
UpgradeSettingsRequest upgradeSettingsRequest = new UpgradeSettingsRequest(upgradeResponse.versions());
|
||||
client.executeLocally(UpgradeSettingsAction.INSTANCE, upgradeSettingsRequest, new ActionListener<UpgradeSettingsResponse>() {
|
||||
client.executeLocally(UpgradeSettingsAction.INSTANCE, upgradeSettingsRequest, new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(UpgradeSettingsResponse updateSettingsResponse) {
|
||||
public void onResponse(AcknowledgedResponse updateSettingsResponse) {
|
||||
listener.onResponse(upgradeResponse);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.action.admin.indices.upgrade.post;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse;
|
||||
@ -35,7 +36,7 @@ import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportUpgradeSettingsAction extends TransportMasterNodeAction<UpgradeSettingsRequest, UpgradeSettingsResponse> {
|
||||
public class TransportUpgradeSettingsAction extends TransportMasterNodeAction<UpgradeSettingsRequest, AcknowledgedResponse> {
|
||||
|
||||
private final MetaDataUpdateSettingsService updateSettingsService;
|
||||
|
||||
@ -58,12 +59,12 @@ public class TransportUpgradeSettingsAction extends TransportMasterNodeAction<Up
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UpgradeSettingsResponse newResponse() {
|
||||
return new UpgradeSettingsResponse();
|
||||
protected AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(final UpgradeSettingsRequest request, final ClusterState state, final ActionListener<UpgradeSettingsResponse> listener) {
|
||||
protected void masterOperation(final UpgradeSettingsRequest request, final ClusterState state, final ActionListener<AcknowledgedResponse> listener) {
|
||||
UpgradeSettingsClusterStateUpdateRequest clusterStateUpdateRequest = new UpgradeSettingsClusterStateUpdateRequest()
|
||||
.ackTimeout(request.timeout())
|
||||
.versions(request.versions())
|
||||
@ -72,7 +73,7 @@ public class TransportUpgradeSettingsAction extends TransportMasterNodeAction<Up
|
||||
updateSettingsService.upgradeIndexSettings(clusterStateUpdateRequest, new ActionListener<ClusterStateUpdateResponse>() {
|
||||
@Override
|
||||
public void onResponse(ClusterStateUpdateResponse response) {
|
||||
listener.onResponse(new UpgradeSettingsResponse(response.isAcknowledged()));
|
||||
listener.onResponse(new AcknowledgedResponse(response.isAcknowledged()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,9 @@
|
||||
package org.elasticsearch.action.admin.indices.upgrade.post;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class UpgradeSettingsAction extends Action<UpgradeSettingsResponse> {
|
||||
public class UpgradeSettingsAction extends Action<AcknowledgedResponse> {
|
||||
|
||||
public static final UpgradeSettingsAction INSTANCE = new UpgradeSettingsAction();
|
||||
public static final String NAME = "internal:indices/admin/upgrade";
|
||||
@ -31,7 +32,7 @@ public class UpgradeSettingsAction extends Action<UpgradeSettingsResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpgradeSettingsResponse newResponse() {
|
||||
return new UpgradeSettingsResponse();
|
||||
public AcknowledgedResponse newResponse() {
|
||||
return new AcknowledgedResponse();
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.indices.upgrade.post;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
|
||||
@ -29,7 +30,7 @@ import java.util.Map;
|
||||
/**
|
||||
* Builder for an update index settings request
|
||||
*/
|
||||
public class UpgradeSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpgradeSettingsRequest, UpgradeSettingsResponse, UpgradeSettingsRequestBuilder> {
|
||||
public class UpgradeSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpgradeSettingsRequest, AcknowledgedResponse, UpgradeSettingsRequestBuilder> {
|
||||
|
||||
public UpgradeSettingsRequestBuilder(ElasticsearchClient client, UpgradeSettingsAction action) {
|
||||
super(client, action, new UpgradeSettingsRequest());
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.upgrade.post;
|
||||
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
/**
|
||||
* A response for an update index settings action
|
||||
*/
|
||||
public class UpgradeSettingsResponse extends AcknowledgedResponse {
|
||||
|
||||
UpgradeSettingsResponse() {
|
||||
}
|
||||
|
||||
UpgradeSettingsResponse(boolean acknowledged) {
|
||||
super(acknowledged);
|
||||
}
|
||||
}
|
@ -98,11 +98,6 @@ public class AcknowledgedResponse extends ActionResponse implements ToXContentOb
|
||||
ObjectParser.ValueType.BOOLEAN);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean parseAcknowledged(XContentParser parser) {
|
||||
return ACKNOWLEDGED_FLAG_PARSER.apply(parser, null);
|
||||
}
|
||||
|
||||
public static AcknowledgedResponse fromXContent(XContentParser parser) throws IOException {
|
||||
return new AcknowledgedResponse(ACKNOWLEDGED_FLAG_PARSER.apply(parser, null));
|
||||
}
|
||||
|
@ -51,13 +51,11 @@ import org.elasticsearch.action.admin.cluster.node.usage.NodesUsageRequestBuilde
|
||||
import org.elasticsearch.action.admin.cluster.node.usage.NodesUsageResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse;
|
||||
@ -75,7 +73,6 @@ import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotReq
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
@ -93,13 +90,11 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
||||
@ -416,12 +411,12 @@ public interface ClusterAdminClient extends ElasticsearchClient {
|
||||
/**
|
||||
* Registers a snapshot repository.
|
||||
*/
|
||||
ActionFuture<PutRepositoryResponse> putRepository(PutRepositoryRequest request);
|
||||
ActionFuture<AcknowledgedResponse> putRepository(PutRepositoryRequest request);
|
||||
|
||||
/**
|
||||
* Registers a snapshot repository.
|
||||
*/
|
||||
void putRepository(PutRepositoryRequest request, ActionListener<PutRepositoryResponse> listener);
|
||||
void putRepository(PutRepositoryRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Registers a snapshot repository.
|
||||
@ -431,12 +426,12 @@ public interface ClusterAdminClient extends ElasticsearchClient {
|
||||
/**
|
||||
* Unregisters a repository.
|
||||
*/
|
||||
ActionFuture<DeleteRepositoryResponse> deleteRepository(DeleteRepositoryRequest request);
|
||||
ActionFuture<AcknowledgedResponse> deleteRepository(DeleteRepositoryRequest request);
|
||||
|
||||
/**
|
||||
* Unregisters a repository.
|
||||
*/
|
||||
void deleteRepository(DeleteRepositoryRequest request, ActionListener<DeleteRepositoryResponse> listener);
|
||||
void deleteRepository(DeleteRepositoryRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Unregisters a repository.
|
||||
@ -506,12 +501,12 @@ public interface ClusterAdminClient extends ElasticsearchClient {
|
||||
/**
|
||||
* Delete snapshot.
|
||||
*/
|
||||
ActionFuture<DeleteSnapshotResponse> deleteSnapshot(DeleteSnapshotRequest request);
|
||||
ActionFuture<AcknowledgedResponse> deleteSnapshot(DeleteSnapshotRequest request);
|
||||
|
||||
/**
|
||||
* Delete snapshot.
|
||||
*/
|
||||
void deleteSnapshot(DeleteSnapshotRequest request, ActionListener<DeleteSnapshotResponse> listener);
|
||||
void deleteSnapshot(DeleteSnapshotRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Delete snapshot.
|
||||
@ -672,12 +667,12 @@ public interface ClusterAdminClient extends ElasticsearchClient {
|
||||
/**
|
||||
* Delete a script from the cluster state
|
||||
*/
|
||||
void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener<DeleteStoredScriptResponse> listener);
|
||||
void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Delete a script from the cluster state
|
||||
*/
|
||||
ActionFuture<DeleteStoredScriptResponse> deleteStoredScript(DeleteStoredScriptRequest request);
|
||||
ActionFuture<AcknowledgedResponse> deleteStoredScript(DeleteStoredScriptRequest request);
|
||||
|
||||
/**
|
||||
* Delete a script from the cluster state
|
||||
@ -692,12 +687,12 @@ public interface ClusterAdminClient extends ElasticsearchClient {
|
||||
/**
|
||||
* Store a script in the cluster state
|
||||
*/
|
||||
void putStoredScript(PutStoredScriptRequest request, ActionListener<PutStoredScriptResponse> listener);
|
||||
void putStoredScript(PutStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Store a script in the cluster state
|
||||
*/
|
||||
ActionFuture<PutStoredScriptResponse> putStoredScript(PutStoredScriptRequest request);
|
||||
ActionFuture<AcknowledgedResponse> putStoredScript(PutStoredScriptRequest request);
|
||||
|
||||
/**
|
||||
* Get a script from the cluster state
|
||||
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionFuture;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
@ -37,13 +36,11 @@ import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheReque
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
|
||||
@ -70,7 +67,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuil
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
||||
@ -91,7 +87,6 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequestBui
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoreRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest;
|
||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse;
|
||||
@ -103,13 +98,11 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse;
|
||||
@ -119,6 +112,7 @@ import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
|
||||
/**
|
||||
@ -281,7 +275,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @return The result future
|
||||
* @see org.elasticsearch.client.Requests#deleteIndexRequest(String)
|
||||
*/
|
||||
ActionFuture<DeleteIndexResponse> delete(DeleteIndexRequest request);
|
||||
ActionFuture<AcknowledgedResponse> delete(DeleteIndexRequest request);
|
||||
|
||||
/**
|
||||
* Deletes an index based on the index name.
|
||||
@ -290,7 +284,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @param listener A listener to be notified with a result
|
||||
* @see org.elasticsearch.client.Requests#deleteIndexRequest(String)
|
||||
*/
|
||||
void delete(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener);
|
||||
void delete(DeleteIndexRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Deletes an index based on the index name.
|
||||
@ -306,7 +300,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @return The result future
|
||||
* @see org.elasticsearch.client.Requests#closeIndexRequest(String)
|
||||
*/
|
||||
ActionFuture<CloseIndexResponse> close(CloseIndexRequest request);
|
||||
ActionFuture<AcknowledgedResponse> close(CloseIndexRequest request);
|
||||
|
||||
/**
|
||||
* Closes an index based on the index name.
|
||||
@ -315,7 +309,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @param listener A listener to be notified with a result
|
||||
* @see org.elasticsearch.client.Requests#closeIndexRequest(String)
|
||||
*/
|
||||
void close(CloseIndexRequest request, ActionListener<CloseIndexResponse> listener);
|
||||
void close(CloseIndexRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Closes one or more indices based on their index name.
|
||||
@ -524,7 +518,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @return A result future
|
||||
* @see org.elasticsearch.client.Requests#putMappingRequest(String...)
|
||||
*/
|
||||
ActionFuture<PutMappingResponse> putMapping(PutMappingRequest request);
|
||||
ActionFuture<AcknowledgedResponse> putMapping(PutMappingRequest request);
|
||||
|
||||
/**
|
||||
* Add mapping definition for a type into one or more indices.
|
||||
@ -533,7 +527,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @param listener A listener to be notified with a result
|
||||
* @see org.elasticsearch.client.Requests#putMappingRequest(String...)
|
||||
*/
|
||||
void putMapping(PutMappingRequest request, ActionListener<PutMappingResponse> listener);
|
||||
void putMapping(PutMappingRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Add mapping definition for a type into one or more indices.
|
||||
@ -547,7 +541,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @return The result future
|
||||
* @see Requests#indexAliasesRequest()
|
||||
*/
|
||||
ActionFuture<IndicesAliasesResponse> aliases(IndicesAliasesRequest request);
|
||||
ActionFuture<AcknowledgedResponse> aliases(IndicesAliasesRequest request);
|
||||
|
||||
/**
|
||||
* Allows to add/remove aliases from indices.
|
||||
@ -556,7 +550,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @param listener A listener to be notified with a result
|
||||
* @see Requests#indexAliasesRequest()
|
||||
*/
|
||||
void aliases(IndicesAliasesRequest request, ActionListener<IndicesAliasesResponse> listener);
|
||||
void aliases(IndicesAliasesRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Allows to add/remove aliases from indices.
|
||||
@ -652,7 +646,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @param request the update settings request
|
||||
* @return The result future
|
||||
*/
|
||||
ActionFuture<UpdateSettingsResponse> updateSettings(UpdateSettingsRequest request);
|
||||
ActionFuture<AcknowledgedResponse> updateSettings(UpdateSettingsRequest request);
|
||||
|
||||
/**
|
||||
* Updates settings of one or more indices.
|
||||
@ -660,7 +654,7 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
* @param request the update settings request
|
||||
* @param listener A listener to be notified with the response
|
||||
*/
|
||||
void updateSettings(UpdateSettingsRequest request, ActionListener<UpdateSettingsResponse> listener);
|
||||
void updateSettings(UpdateSettingsRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Update indices settings.
|
||||
@ -701,12 +695,12 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
/**
|
||||
* Puts an index template.
|
||||
*/
|
||||
ActionFuture<PutIndexTemplateResponse> putTemplate(PutIndexTemplateRequest request);
|
||||
ActionFuture<AcknowledgedResponse> putTemplate(PutIndexTemplateRequest request);
|
||||
|
||||
/**
|
||||
* Puts an index template.
|
||||
*/
|
||||
void putTemplate(PutIndexTemplateRequest request, ActionListener<PutIndexTemplateResponse> listener);
|
||||
void putTemplate(PutIndexTemplateRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Puts an index template.
|
||||
@ -718,12 +712,12 @@ public interface IndicesAdminClient extends ElasticsearchClient {
|
||||
/**
|
||||
* Deletes index template.
|
||||
*/
|
||||
ActionFuture<DeleteIndexTemplateResponse> deleteTemplate(DeleteIndexTemplateRequest request);
|
||||
ActionFuture<AcknowledgedResponse> deleteTemplate(DeleteIndexTemplateRequest request);
|
||||
|
||||
/**
|
||||
* Deletes an index template.
|
||||
*/
|
||||
void deleteTemplate(DeleteIndexTemplateRequest request, ActionListener<DeleteIndexTemplateResponse> listener);
|
||||
void deleteTemplate(DeleteIndexTemplateRequest request, ActionListener<AcknowledgedResponse> listener);
|
||||
|
||||
/**
|
||||
* Deletes an index template.
|
||||
|
@ -65,7 +65,6 @@ import org.elasticsearch.action.admin.cluster.node.usage.NodesUsageResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryAction;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesAction;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequestBuilder;
|
||||
@ -73,7 +72,6 @@ import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRe
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryAction;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryAction;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequestBuilder;
|
||||
@ -97,7 +95,6 @@ import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRes
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotAction;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsAction;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequestBuilder;
|
||||
@ -121,7 +118,6 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequestBuilder;
|
||||
@ -129,7 +125,6 @@ import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRespo
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksAction;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequestBuilder;
|
||||
@ -137,7 +132,6 @@ import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse;
|
||||
@ -156,7 +150,6 @@ import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRespo
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
|
||||
@ -164,7 +157,6 @@ import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsAction;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder;
|
||||
@ -200,7 +192,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder;
|
||||
@ -228,7 +219,6 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsAction;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoreRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresAction;
|
||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest;
|
||||
@ -244,7 +234,6 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateAction;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesAction;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequestBuilder;
|
||||
@ -252,7 +241,6 @@ import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResp
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateAction;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusAction;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequestBuilder;
|
||||
@ -939,12 +927,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<PutRepositoryResponse> putRepository(PutRepositoryRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> putRepository(PutRepositoryRequest request) {
|
||||
return execute(PutRepositoryAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putRepository(PutRepositoryRequest request, ActionListener<PutRepositoryResponse> listener) {
|
||||
public void putRepository(PutRepositoryRequest request, ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(PutRepositoryAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -985,12 +973,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
|
||||
|
||||
@Override
|
||||
public ActionFuture<DeleteSnapshotResponse> deleteSnapshot(DeleteSnapshotRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> deleteSnapshot(DeleteSnapshotRequest request) {
|
||||
return execute(DeleteSnapshotAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSnapshot(DeleteSnapshotRequest request, ActionListener<DeleteSnapshotResponse> listener) {
|
||||
public void deleteSnapshot(DeleteSnapshotRequest request, ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(DeleteSnapshotAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1001,12 +989,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
|
||||
|
||||
@Override
|
||||
public ActionFuture<DeleteRepositoryResponse> deleteRepository(DeleteRepositoryRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> deleteRepository(DeleteRepositoryRequest request) {
|
||||
return execute(DeleteRepositoryAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRepository(DeleteRepositoryRequest request, ActionListener<DeleteRepositoryResponse> listener) {
|
||||
public void deleteRepository(DeleteRepositoryRequest request, ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(DeleteRepositoryAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1197,23 +1185,23 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStoredScript(final PutStoredScriptRequest request, ActionListener<PutStoredScriptResponse> listener){
|
||||
public void putStoredScript(final PutStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener){
|
||||
execute(PutStoredScriptAction.INSTANCE, request, listener);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<PutStoredScriptResponse> putStoredScript(final PutStoredScriptRequest request){
|
||||
public ActionFuture<AcknowledgedResponse> putStoredScript(final PutStoredScriptRequest request){
|
||||
return execute(PutStoredScriptAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener<DeleteStoredScriptResponse> listener){
|
||||
public void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener<AcknowledgedResponse> listener){
|
||||
execute(DeleteStoredScriptAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<DeleteStoredScriptResponse> deleteStoredScript(DeleteStoredScriptRequest request){
|
||||
public ActionFuture<AcknowledgedResponse> deleteStoredScript(DeleteStoredScriptRequest request){
|
||||
return execute(DeleteStoredScriptAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@ -1284,12 +1272,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<IndicesAliasesResponse> aliases(final IndicesAliasesRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> aliases(final IndicesAliasesRequest request) {
|
||||
return execute(IndicesAliasesAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aliases(final IndicesAliasesRequest request, final ActionListener<IndicesAliasesResponse> listener) {
|
||||
public void aliases(final IndicesAliasesRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(IndicesAliasesAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1374,12 +1362,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<DeleteIndexResponse> delete(final DeleteIndexRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> delete(final DeleteIndexRequest request) {
|
||||
return execute(DeleteIndexAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(final DeleteIndexRequest request, final ActionListener<DeleteIndexResponse> listener) {
|
||||
public void delete(final DeleteIndexRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(DeleteIndexAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1389,12 +1377,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<CloseIndexResponse> close(final CloseIndexRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> close(final CloseIndexRequest request) {
|
||||
return execute(CloseIndexAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(final CloseIndexRequest request, final ActionListener<CloseIndexResponse> listener) {
|
||||
public void close(final CloseIndexRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(CloseIndexAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1479,12 +1467,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<PutMappingResponse> putMapping(final PutMappingRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> putMapping(final PutMappingRequest request) {
|
||||
return execute(PutMappingAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putMapping(final PutMappingRequest request, final ActionListener<PutMappingResponse> listener) {
|
||||
public void putMapping(final PutMappingRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(PutMappingAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1614,12 +1602,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<UpdateSettingsResponse> updateSettings(final UpdateSettingsRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> updateSettings(final UpdateSettingsRequest request) {
|
||||
return execute(UpdateSettingsAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(final UpdateSettingsRequest request, final ActionListener<UpdateSettingsResponse> listener) {
|
||||
public void updateSettings(final UpdateSettingsRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(UpdateSettingsAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1654,12 +1642,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<PutIndexTemplateResponse> putTemplate(final PutIndexTemplateRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> putTemplate(final PutIndexTemplateRequest request) {
|
||||
return execute(PutIndexTemplateAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putTemplate(final PutIndexTemplateRequest request, final ActionListener<PutIndexTemplateResponse> listener) {
|
||||
public void putTemplate(final PutIndexTemplateRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(PutIndexTemplateAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@ -1684,12 +1672,12 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<DeleteIndexTemplateResponse> deleteTemplate(final DeleteIndexTemplateRequest request) {
|
||||
public ActionFuture<AcknowledgedResponse> deleteTemplate(final DeleteIndexTemplateRequest request) {
|
||||
return execute(DeleteIndexTemplateAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTemplate(final DeleteIndexTemplateRequest request, final ActionListener<DeleteIndexTemplateResponse> listener) {
|
||||
public void deleteTemplate(final DeleteIndexTemplateRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(DeleteIndexTemplateAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
|
@ -24,9 +24,8 @@ import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.ClusterChangedEvent;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
@ -147,9 +146,9 @@ public class TemplateUpgradeService extends AbstractComponent implements Cluster
|
||||
PutIndexTemplateRequest request =
|
||||
new PutIndexTemplateRequest(change.getKey()).source(change.getValue(), XContentType.JSON);
|
||||
request.masterNodeTimeout(TimeValue.timeValueMinutes(1));
|
||||
client.admin().indices().putTemplate(request, new ActionListener<PutIndexTemplateResponse>() {
|
||||
client.admin().indices().putTemplate(request, new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutIndexTemplateResponse response) {
|
||||
public void onResponse(AcknowledgedResponse response) {
|
||||
if (response.isAcknowledged() == false) {
|
||||
anyUpgradeFailed.set(true);
|
||||
logger.warn("Error updating template [{}], request was not acknowledged", change.getKey());
|
||||
@ -169,9 +168,9 @@ public class TemplateUpgradeService extends AbstractComponent implements Cluster
|
||||
for (String template : deletions) {
|
||||
DeleteIndexTemplateRequest request = new DeleteIndexTemplateRequest(template);
|
||||
request.masterNodeTimeout(TimeValue.timeValueMinutes(1));
|
||||
client.admin().indices().deleteTemplate(request, new ActionListener<DeleteIndexTemplateResponse>() {
|
||||
client.admin().indices().deleteTemplate(request, new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteIndexTemplateResponse response) {
|
||||
public void onResponse(AcknowledgedResponse response) {
|
||||
if (response.isAcknowledged() == false) {
|
||||
anyUpgradeFailed.set(true);
|
||||
logger.warn("Error deleting template [{}], request was not acknowledged", template);
|
||||
|
@ -297,13 +297,13 @@ public final class ClusterSettings extends AbstractScopedSettings {
|
||||
TcpTransport.TCP_REUSE_ADDRESS_PROFILE,
|
||||
TcpTransport.TCP_SEND_BUFFER_SIZE_PROFILE,
|
||||
TcpTransport.TCP_RECEIVE_BUFFER_SIZE_PROFILE,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_RECOVERY,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_BULK,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_REG,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_STATE,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_PING,
|
||||
TransportService.CONNECTIONS_PER_NODE_RECOVERY,
|
||||
TransportService.CONNECTIONS_PER_NODE_BULK,
|
||||
TransportService.CONNECTIONS_PER_NODE_REG,
|
||||
TransportService.CONNECTIONS_PER_NODE_STATE,
|
||||
TransportService.CONNECTIONS_PER_NODE_PING,
|
||||
TransportService.TCP_CONNECT_TIMEOUT,
|
||||
TcpTransport.PING_SCHEDULE,
|
||||
TcpTransport.TCP_CONNECT_TIMEOUT,
|
||||
NetworkService.NETWORK_SERVER,
|
||||
TcpTransport.TCP_NO_DELAY,
|
||||
TcpTransport.TCP_KEEP_ALIVE,
|
||||
|
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.shard;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import static org.elasticsearch.index.seqno.SequenceNumbers.NO_OPS_PERFORMED;
|
||||
import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO;
|
||||
|
||||
/**
|
||||
* Represents a collection of global checkpoint listeners. This collection can be added to, and all listeners present at the time of an
|
||||
* update will be notified together. All listeners will be notified when the shard is closed.
|
||||
*/
|
||||
public class GlobalCheckpointListeners implements Closeable {
|
||||
|
||||
/**
|
||||
* A global checkpoint listener consisting of a callback that is notified when the global checkpoint is updated or the shard is closed.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface GlobalCheckpointListener {
|
||||
/**
|
||||
* Callback when the global checkpoint is updated or the shard is closed. If the shard is closed, the value of the global checkpoint
|
||||
* will be set to {@link org.elasticsearch.index.seqno.SequenceNumbers#UNASSIGNED_SEQ_NO} and the exception will be non-null. If the
|
||||
* global checkpoint is updated, the exception will be null.
|
||||
*
|
||||
* @param globalCheckpoint the updated global checkpoint
|
||||
* @param e if non-null, the shard is closed
|
||||
*/
|
||||
void accept(long globalCheckpoint, IndexShardClosedException e);
|
||||
}
|
||||
|
||||
// guarded by this
|
||||
private boolean closed;
|
||||
private volatile List<GlobalCheckpointListener> listeners;
|
||||
private long lastKnownGlobalCheckpoint = UNASSIGNED_SEQ_NO;
|
||||
|
||||
private final ShardId shardId;
|
||||
private final Executor executor;
|
||||
private final Logger logger;
|
||||
|
||||
/**
|
||||
* Construct a global checkpoint listeners collection.
|
||||
*
|
||||
* @param shardId the shard ID on which global checkpoint updates can be listened to
|
||||
* @param executor the executor for listener notifications
|
||||
* @param logger a shard-level logger
|
||||
*/
|
||||
GlobalCheckpointListeners(
|
||||
final ShardId shardId,
|
||||
final Executor executor,
|
||||
final Logger logger) {
|
||||
this.shardId = Objects.requireNonNull(shardId);
|
||||
this.executor = Objects.requireNonNull(executor);
|
||||
this.logger = Objects.requireNonNull(logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a global checkpoint listener. If the global checkpoint is above the current global checkpoint known to the listener then the
|
||||
* listener will be asynchronously notified on the executor used to construct this collection of global checkpoint listeners. If the
|
||||
* shard is closed then the listener will be asynchronously notified on the executor used to construct this collection of global
|
||||
* checkpoint listeners. The listener will only be notified of at most one event, either the global checkpoint is updated or the shard
|
||||
* is closed. A listener must re-register after one of these events to receive subsequent events.
|
||||
*
|
||||
* @param currentGlobalCheckpoint the current global checkpoint known to the listener
|
||||
* @param listener the listener
|
||||
*/
|
||||
synchronized void add(final long currentGlobalCheckpoint, final GlobalCheckpointListener listener) {
|
||||
if (closed) {
|
||||
executor.execute(() -> notifyListener(listener, UNASSIGNED_SEQ_NO, new IndexShardClosedException(shardId)));
|
||||
return;
|
||||
}
|
||||
if (lastKnownGlobalCheckpoint > currentGlobalCheckpoint) {
|
||||
// notify directly
|
||||
executor.execute(() -> notifyListener(listener, lastKnownGlobalCheckpoint, null));
|
||||
return;
|
||||
} else {
|
||||
if (listeners == null) {
|
||||
listeners = new ArrayList<>();
|
||||
}
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void close() throws IOException {
|
||||
closed = true;
|
||||
notifyListeners(UNASSIGNED_SEQ_NO, new IndexShardClosedException(shardId));
|
||||
}
|
||||
|
||||
synchronized int pendingListeners() {
|
||||
return listeners == null ? 0 : listeners.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke to notify all registered listeners of an updated global checkpoint.
|
||||
*
|
||||
* @param globalCheckpoint the updated global checkpoint
|
||||
*/
|
||||
synchronized void globalCheckpointUpdated(final long globalCheckpoint) {
|
||||
assert globalCheckpoint >= NO_OPS_PERFORMED;
|
||||
assert globalCheckpoint > lastKnownGlobalCheckpoint
|
||||
: "updated global checkpoint [" + globalCheckpoint + "]"
|
||||
+ " is not more than the last known global checkpoint [" + lastKnownGlobalCheckpoint + "]";
|
||||
lastKnownGlobalCheckpoint = globalCheckpoint;
|
||||
notifyListeners(globalCheckpoint, null);
|
||||
}
|
||||
|
||||
private void notifyListeners(final long globalCheckpoint, final IndexShardClosedException e) {
|
||||
assert Thread.holdsLock(this);
|
||||
assert (globalCheckpoint == UNASSIGNED_SEQ_NO && e != null) || (globalCheckpoint >= NO_OPS_PERFORMED && e == null);
|
||||
if (listeners != null) {
|
||||
// capture the current listeners
|
||||
final List<GlobalCheckpointListener> currentListeners = listeners;
|
||||
listeners = null;
|
||||
if (currentListeners != null) {
|
||||
executor.execute(() -> {
|
||||
for (final GlobalCheckpointListener listener : currentListeners) {
|
||||
notifyListener(listener, globalCheckpoint, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyListener(final GlobalCheckpointListener listener, final long globalCheckpoint, final IndexShardClosedException e) {
|
||||
try {
|
||||
listener.accept(globalCheckpoint, e);
|
||||
} catch (final Exception caught) {
|
||||
if (globalCheckpoint != UNASSIGNED_SEQ_NO) {
|
||||
logger.warn(
|
||||
new ParameterizedMessage(
|
||||
"error notifying global checkpoint listener of updated global checkpoint [{}]",
|
||||
globalCheckpoint),
|
||||
caught);
|
||||
} else {
|
||||
logger.warn("error notifying global checkpoint listener of closed shard", caught);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -161,6 +161,8 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import static org.elasticsearch.index.mapper.SourceToParse.source;
|
||||
import static org.elasticsearch.index.seqno.SequenceNumbers.NO_OPS_PERFORMED;
|
||||
import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO;
|
||||
|
||||
public class IndexShard extends AbstractIndexShardComponent implements IndicesClusterStateService.Shard {
|
||||
|
||||
@ -189,6 +191,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
|
||||
private final SearchOperationListener searchOperationListener;
|
||||
|
||||
private final GlobalCheckpointListeners globalCheckpointListeners;
|
||||
private final ReplicationTracker replicationTracker;
|
||||
|
||||
protected volatile ShardRouting shardRouting;
|
||||
@ -298,8 +301,10 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
this.checkIndexOnStartup = indexSettings.getValue(IndexSettings.INDEX_CHECK_ON_STARTUP);
|
||||
this.translogConfig = new TranslogConfig(shardId, shardPath().resolveTranslog(), indexSettings, bigArrays);
|
||||
final String aId = shardRouting.allocationId().getId();
|
||||
this.globalCheckpointListeners = new GlobalCheckpointListeners(shardId, threadPool.executor(ThreadPool.Names.LISTENER), logger);
|
||||
this.replicationTracker =
|
||||
new ReplicationTracker(shardId, aId, indexSettings, SequenceNumbers.UNASSIGNED_SEQ_NO, globalCheckpoint -> {});
|
||||
new ReplicationTracker(shardId, aId, indexSettings, UNASSIGNED_SEQ_NO, globalCheckpointListeners::globalCheckpointUpdated);
|
||||
|
||||
// the query cache is a node-level thing, however we want the most popular filters
|
||||
// to be computed on a per-shard basis
|
||||
if (IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.get(settings)) {
|
||||
@ -664,7 +669,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
public Engine.IndexResult applyIndexOperationOnPrimary(long version, VersionType versionType, SourceToParse sourceToParse,
|
||||
long autoGeneratedTimestamp, boolean isRetry) throws IOException {
|
||||
assert versionType.validateVersionForWrites(version);
|
||||
return applyIndexOperation(SequenceNumbers.UNASSIGNED_SEQ_NO, operationPrimaryTerm, version, versionType, autoGeneratedTimestamp,
|
||||
return applyIndexOperation(UNASSIGNED_SEQ_NO, operationPrimaryTerm, version, versionType, autoGeneratedTimestamp,
|
||||
isRetry, Engine.Operation.Origin.PRIMARY, sourceToParse);
|
||||
}
|
||||
|
||||
@ -765,7 +770,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
public Engine.DeleteResult applyDeleteOperationOnPrimary(long version, String type, String id, VersionType versionType)
|
||||
throws IOException {
|
||||
assert versionType.validateVersionForWrites(version);
|
||||
return applyDeleteOperation(SequenceNumbers.UNASSIGNED_SEQ_NO, operationPrimaryTerm, version, type, id, versionType,
|
||||
return applyDeleteOperation(UNASSIGNED_SEQ_NO, operationPrimaryTerm, version, type, id, versionType,
|
||||
Engine.Operation.Origin.PRIMARY);
|
||||
}
|
||||
|
||||
@ -1192,7 +1197,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
} finally {
|
||||
// playing safe here and close the engine even if the above succeeds - close can be called multiple times
|
||||
// Also closing refreshListeners to prevent us from accumulating any more listeners
|
||||
IOUtils.close(engine, refreshListeners);
|
||||
IOUtils.close(engine, globalCheckpointListeners, refreshListeners);
|
||||
indexShardOperationPermits.close();
|
||||
}
|
||||
}
|
||||
@ -1729,6 +1734,19 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
replicationTracker.updateGlobalCheckpointForShard(allocationId, globalCheckpoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a global checkpoint listener. If the global checkpoint is above the current global checkpoint known to the listener then the
|
||||
* listener will fire immediately on the calling thread.
|
||||
*
|
||||
* @param currentGlobalCheckpoint the current global checkpoint known to the listener
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void addGlobalCheckpointListener(
|
||||
final long currentGlobalCheckpoint,
|
||||
final GlobalCheckpointListeners.GlobalCheckpointListener listener) {
|
||||
this.globalCheckpointListeners.add(currentGlobalCheckpoint, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for all operations up to the provided sequence number to complete.
|
||||
*
|
||||
@ -2273,8 +2291,8 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
updateGlobalCheckpointOnReplica(globalCheckpoint, "primary term transition");
|
||||
final long currentGlobalCheckpoint = getGlobalCheckpoint();
|
||||
final long localCheckpoint;
|
||||
if (currentGlobalCheckpoint == SequenceNumbers.UNASSIGNED_SEQ_NO) {
|
||||
localCheckpoint = SequenceNumbers.NO_OPS_PERFORMED;
|
||||
if (currentGlobalCheckpoint == UNASSIGNED_SEQ_NO) {
|
||||
localCheckpoint = NO_OPS_PERFORMED;
|
||||
} else {
|
||||
localCheckpoint = currentGlobalCheckpoint;
|
||||
}
|
||||
|
@ -284,14 +284,14 @@ public final class ConfigurationUtils {
|
||||
msg = "[" + propertyName + "] " + reason;
|
||||
}
|
||||
ElasticsearchParseException exception = new ElasticsearchParseException(msg);
|
||||
addHeadersToException(exception, processorType, processorTag, propertyName);
|
||||
addMetadataToException(exception, processorType, processorTag, propertyName);
|
||||
return exception;
|
||||
}
|
||||
|
||||
public static ElasticsearchException newConfigurationException(String processorType, String processorTag,
|
||||
String propertyName, Exception cause) {
|
||||
ElasticsearchException exception = ExceptionsHelper.convertToElastic(cause);
|
||||
addHeadersToException(exception, processorType, processorTag, propertyName);
|
||||
addMetadataToException(exception, processorType, processorTag, propertyName);
|
||||
return exception;
|
||||
}
|
||||
|
||||
@ -341,16 +341,16 @@ public final class ConfigurationUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addHeadersToException(ElasticsearchException exception, String processorType,
|
||||
String processorTag, String propertyName) {
|
||||
private static void addMetadataToException(ElasticsearchException exception, String processorType,
|
||||
String processorTag, String propertyName) {
|
||||
if (processorType != null) {
|
||||
exception.addHeader("processor_type", processorType);
|
||||
exception.addMetadata("es.processor_type", processorType);
|
||||
}
|
||||
if (processorTag != null) {
|
||||
exception.addHeader("processor_tag", processorTag);
|
||||
exception.addMetadata("es.processor_tag", processorTag);
|
||||
}
|
||||
if (propertyName != null) {
|
||||
exception.addHeader("property_name", propertyName);
|
||||
exception.addMetadata("es.property_name", propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,12 @@
|
||||
|
||||
package org.elasticsearch.script;
|
||||
|
||||
import org.elasticsearch.core.internal.io.IOUtils;
|
||||
import org.elasticsearch.ResourceNotFoundException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.cluster.AckedClusterStateUpdateTask;
|
||||
import org.elasticsearch.cluster.ClusterChangedEvent;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
@ -46,6 +44,7 @@ import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Property;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.core.internal.io.IOUtils;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
@ -417,7 +416,7 @@ public class ScriptService extends AbstractComponent implements Closeable, Clust
|
||||
}
|
||||
|
||||
public void putStoredScript(ClusterService clusterService, PutStoredScriptRequest request,
|
||||
ActionListener<PutStoredScriptResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
int max = SCRIPT_MAX_SIZE_IN_BYTES.get(settings);
|
||||
|
||||
if (request.content().length() > max) {
|
||||
@ -454,11 +453,11 @@ public class ScriptService extends AbstractComponent implements Closeable, Clust
|
||||
}
|
||||
|
||||
clusterService.submitStateUpdateTask("put-script-" + request.id(),
|
||||
new AckedClusterStateUpdateTask<PutStoredScriptResponse>(request, listener) {
|
||||
new AckedClusterStateUpdateTask<AcknowledgedResponse>(request, listener) {
|
||||
|
||||
@Override
|
||||
protected PutStoredScriptResponse newResponse(boolean acknowledged) {
|
||||
return new PutStoredScriptResponse(acknowledged);
|
||||
protected AcknowledgedResponse newResponse(boolean acknowledged) {
|
||||
return new AcknowledgedResponse(acknowledged);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -473,13 +472,13 @@ public class ScriptService extends AbstractComponent implements Closeable, Clust
|
||||
}
|
||||
|
||||
public void deleteStoredScript(ClusterService clusterService, DeleteStoredScriptRequest request,
|
||||
ActionListener<DeleteStoredScriptResponse> listener) {
|
||||
ActionListener<AcknowledgedResponse> listener) {
|
||||
clusterService.submitStateUpdateTask("delete-script-" + request.id(),
|
||||
new AckedClusterStateUpdateTask<DeleteStoredScriptResponse>(request, listener) {
|
||||
new AckedClusterStateUpdateTask<AcknowledgedResponse>(request, listener) {
|
||||
|
||||
@Override
|
||||
protected DeleteStoredScriptResponse newResponse(boolean acknowledged) {
|
||||
return new DeleteStoredScriptResponse(acknowledged);
|
||||
protected AcknowledgedResponse newResponse(boolean acknowledged) {
|
||||
return new AcknowledgedResponse(acknowledged);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,9 +25,9 @@ import org.elasticsearch.ResourceAlreadyExistsException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
@ -113,9 +113,9 @@ public class TaskResultsService extends AbstractComponent {
|
||||
// The index already exists but doesn't have our mapping
|
||||
client.admin().indices().preparePutMapping(TASK_INDEX).setType(TASK_TYPE)
|
||||
.setSource(taskResultIndexMapping(), XContentType.JSON)
|
||||
.execute(new ActionListener<PutMappingResponse>() {
|
||||
.execute(new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutMappingResponse putMappingResponse) {
|
||||
public void onResponse(AcknowledgedResponse putMappingResponse) {
|
||||
doStoreResult(taskResult, listener);
|
||||
}
|
||||
|
||||
|
@ -60,15 +60,21 @@ public class ConnectionManager implements Closeable {
|
||||
private final Transport transport;
|
||||
private final ThreadPool threadPool;
|
||||
private final TimeValue pingSchedule;
|
||||
private final ConnectionProfile defaultProfile;
|
||||
private final Lifecycle lifecycle = new Lifecycle();
|
||||
private final ReadWriteLock closeLock = new ReentrantReadWriteLock();
|
||||
private final DelegatingNodeConnectionListener connectionListener = new DelegatingNodeConnectionListener();
|
||||
|
||||
public ConnectionManager(Settings settings, Transport transport, ThreadPool threadPool) {
|
||||
this(settings, transport, threadPool, buildDefaultConnectionProfile(settings));
|
||||
}
|
||||
|
||||
public ConnectionManager(Settings settings, Transport transport, ThreadPool threadPool, ConnectionProfile defaultProfile) {
|
||||
this.logger = Loggers.getLogger(getClass(), settings);
|
||||
this.transport = transport;
|
||||
this.threadPool = threadPool;
|
||||
this.pingSchedule = TcpTransport.PING_SCHEDULE.get(settings);
|
||||
this.defaultProfile = defaultProfile;
|
||||
this.lifecycle.moveToStarted();
|
||||
|
||||
if (pingSchedule.millis() > 0) {
|
||||
@ -84,6 +90,10 @@ public class ConnectionManager implements Closeable {
|
||||
this.connectionListener.listeners.remove(listener);
|
||||
}
|
||||
|
||||
public Transport.Connection openConnection(DiscoveryNode node, ConnectionProfile connectionProfile) {
|
||||
return transport.openConnection(node, ConnectionProfile.resolveConnectionProfile(connectionProfile, defaultProfile));
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects to a node with the given connection profile. If the node is already connected this method has no effect.
|
||||
* Once a successful is established, it can be validated before being exposed.
|
||||
@ -91,6 +101,7 @@ public class ConnectionManager implements Closeable {
|
||||
public void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile,
|
||||
CheckedBiConsumer<Transport.Connection, ConnectionProfile, IOException> connectionValidator)
|
||||
throws ConnectTransportException {
|
||||
ConnectionProfile resolvedProfile = ConnectionProfile.resolveConnectionProfile(connectionProfile, defaultProfile);
|
||||
if (node == null) {
|
||||
throw new ConnectTransportException(null, "can't connect to a null node");
|
||||
}
|
||||
@ -104,8 +115,8 @@ public class ConnectionManager implements Closeable {
|
||||
}
|
||||
boolean success = false;
|
||||
try {
|
||||
connection = transport.openConnection(node, connectionProfile);
|
||||
connectionValidator.accept(connection, connectionProfile);
|
||||
connection = transport.openConnection(node, resolvedProfile);
|
||||
connectionValidator.accept(connection, resolvedProfile);
|
||||
// we acquire a connection lock, so no way there is an existing connection
|
||||
connectedNodes.put(node, connection);
|
||||
if (logger.isDebugEnabled()) {
|
||||
@ -279,4 +290,23 @@ public class ConnectionManager implements Closeable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ConnectionProfile buildDefaultConnectionProfile(Settings settings) {
|
||||
int connectionsPerNodeRecovery = TransportService.CONNECTIONS_PER_NODE_RECOVERY.get(settings);
|
||||
int connectionsPerNodeBulk = TransportService.CONNECTIONS_PER_NODE_BULK.get(settings);
|
||||
int connectionsPerNodeReg = TransportService.CONNECTIONS_PER_NODE_REG.get(settings);
|
||||
int connectionsPerNodeState = TransportService.CONNECTIONS_PER_NODE_STATE.get(settings);
|
||||
int connectionsPerNodePing = TransportService.CONNECTIONS_PER_NODE_PING.get(settings);
|
||||
ConnectionProfile.Builder builder = new ConnectionProfile.Builder();
|
||||
builder.setConnectTimeout(TransportService.TCP_CONNECT_TIMEOUT.get(settings));
|
||||
builder.setHandshakeTimeout(TransportService.TCP_CONNECT_TIMEOUT.get(settings));
|
||||
builder.addConnections(connectionsPerNodeBulk, TransportRequestOptions.Type.BULK);
|
||||
builder.addConnections(connectionsPerNodePing, TransportRequestOptions.Type.PING);
|
||||
// if we are not master eligible we don't need a dedicated channel to publish the state
|
||||
builder.addConnections(DiscoveryNode.isMasterNode(settings) ? connectionsPerNodeState : 0, TransportRequestOptions.Type.STATE);
|
||||
// if we are not a data-node we don't need any dedicated channels for recovery
|
||||
builder.addConnections(DiscoveryNode.isDataNode(settings) ? connectionsPerNodeRecovery : 0, TransportRequestOptions.Type.RECOVERY);
|
||||
builder.addConnections(connectionsPerNodeReg, TransportRequestOptions.Type.REG);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ -61,14 +62,35 @@ public final class ConnectionProfile {
|
||||
private final TimeValue connectTimeout;
|
||||
private final TimeValue handshakeTimeout;
|
||||
|
||||
private ConnectionProfile(List<ConnectionTypeHandle> handles, int numConnections, TimeValue connectTimeout, TimeValue handshakeTimeout)
|
||||
{
|
||||
private ConnectionProfile(List<ConnectionTypeHandle> handles, int numConnections, TimeValue connectTimeout,
|
||||
TimeValue handshakeTimeout) {
|
||||
this.handles = handles;
|
||||
this.numConnections = numConnections;
|
||||
this.connectTimeout = connectTimeout;
|
||||
this.handshakeTimeout = handshakeTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* takes a {@link ConnectionProfile} resolves it to a fully specified (i.e., no nulls) profile
|
||||
*/
|
||||
public static ConnectionProfile resolveConnectionProfile(@Nullable ConnectionProfile profile, ConnectionProfile fallbackProfile) {
|
||||
Objects.requireNonNull(fallbackProfile);
|
||||
if (profile == null) {
|
||||
return fallbackProfile;
|
||||
} else if (profile.getConnectTimeout() != null && profile.getHandshakeTimeout() != null) {
|
||||
return profile;
|
||||
} else {
|
||||
ConnectionProfile.Builder builder = new ConnectionProfile.Builder(profile);
|
||||
if (profile.getConnectTimeout() == null) {
|
||||
builder.setConnectTimeout(fallbackProfile.getConnectTimeout());
|
||||
}
|
||||
if (profile.getHandshakeTimeout() == null) {
|
||||
builder.setHandshakeTimeout(fallbackProfile.getHandshakeTimeout());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder to build a new {@link ConnectionProfile}
|
||||
*/
|
||||
|
@ -108,8 +108,8 @@ final class RemoteClusterConnection extends AbstractComponent implements Transpo
|
||||
this.nodePredicate = nodePredicate;
|
||||
this.clusterAlias = clusterAlias;
|
||||
ConnectionProfile.Builder builder = new ConnectionProfile.Builder();
|
||||
builder.setConnectTimeout(TcpTransport.TCP_CONNECT_TIMEOUT.get(settings));
|
||||
builder.setHandshakeTimeout(TcpTransport.TCP_CONNECT_TIMEOUT.get(settings));
|
||||
builder.setConnectTimeout(TransportService.TCP_CONNECT_TIMEOUT.get(settings));
|
||||
builder.setHandshakeTimeout(TransportService.TCP_CONNECT_TIMEOUT.get(settings));
|
||||
builder.addConnections(6, TransportRequestOptions.Type.REG, TransportRequestOptions.Type.PING); // TODO make this configurable?
|
||||
builder.addConnections(0, // we don't want this to be used for anything else but search
|
||||
TransportRequestOptions.Type.BULK,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user