Added base ClusterStateUpdateRequest class that executes on multiple indices
This commit is contained in:
parent
39c606c59a
commit
ec3d858cc2
|
@ -18,25 +18,14 @@
|
|||
|
||||
package org.elasticsearch.action.admin.indices.close;
|
||||
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateRequest;
|
||||
import org.elasticsearch.cluster.ack.IndicesClusterStateUpdateRequest;
|
||||
|
||||
/**
|
||||
* Cluster state update request that allows to close one or more indices
|
||||
*/
|
||||
public class CloseIndexClusterStateUpdateRequest extends ClusterStateUpdateRequest<CloseIndexClusterStateUpdateRequest> {
|
||||
|
||||
private String[] indices;
|
||||
public class CloseIndexClusterStateUpdateRequest extends IndicesClusterStateUpdateRequest<CloseIndexClusterStateUpdateRequest> {
|
||||
|
||||
CloseIndexClusterStateUpdateRequest() {
|
||||
|
||||
}
|
||||
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public CloseIndexClusterStateUpdateRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,35 +19,19 @@
|
|||
|
||||
package org.elasticsearch.action.admin.indices.mapping.delete;
|
||||
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateRequest;
|
||||
import org.elasticsearch.cluster.ack.IndicesClusterStateUpdateRequest;
|
||||
|
||||
/**
|
||||
* Cluster state update request that allows to delete a mapping
|
||||
*/
|
||||
public class DeleteMappingClusterStateUpdateRequest extends ClusterStateUpdateRequest<DeleteMappingClusterStateUpdateRequest> {
|
||||
public class DeleteMappingClusterStateUpdateRequest extends IndicesClusterStateUpdateRequest<DeleteMappingClusterStateUpdateRequest> {
|
||||
|
||||
private String[] indices;
|
||||
private String type;
|
||||
|
||||
DeleteMappingClusterStateUpdateRequest() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the indices the operation needs to be executed on
|
||||
*/
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the indices the operation needs to be executed on
|
||||
*/
|
||||
public DeleteMappingClusterStateUpdateRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type to be removed
|
||||
*/
|
||||
|
|
|
@ -18,25 +18,14 @@
|
|||
|
||||
package org.elasticsearch.action.admin.indices.open;
|
||||
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateRequest;
|
||||
import org.elasticsearch.cluster.ack.IndicesClusterStateUpdateRequest;
|
||||
|
||||
/**
|
||||
* Cluster state update request that allows to open one or more indices
|
||||
*/
|
||||
public class OpenIndexClusterStateUpdateRequest extends ClusterStateUpdateRequest<OpenIndexClusterStateUpdateRequest> {
|
||||
|
||||
private String[] indices;
|
||||
public class OpenIndexClusterStateUpdateRequest extends IndicesClusterStateUpdateRequest<OpenIndexClusterStateUpdateRequest> {
|
||||
|
||||
OpenIndexClusterStateUpdateRequest() {
|
||||
|
||||
}
|
||||
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public OpenIndexClusterStateUpdateRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,35 +19,20 @@
|
|||
|
||||
package org.elasticsearch.action.admin.indices.settings;
|
||||
|
||||
import org.elasticsearch.cluster.ack.ClusterStateUpdateRequest;
|
||||
import org.elasticsearch.cluster.ack.IndicesClusterStateUpdateRequest;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
* Cluster state update request that allows to update settings for some indices
|
||||
*/
|
||||
public class UpdateSettingsClusterStateUpdateRequest extends ClusterStateUpdateRequest<UpdateSettingsClusterStateUpdateRequest> {
|
||||
public class UpdateSettingsClusterStateUpdateRequest extends IndicesClusterStateUpdateRequest<UpdateSettingsClusterStateUpdateRequest> {
|
||||
|
||||
private Settings settings;
|
||||
private String[] indices;
|
||||
|
||||
public UpdateSettingsClusterStateUpdateRequest() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the indices that needs to be updated
|
||||
*/
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the indices to update
|
||||
*/
|
||||
public UpdateSettingsClusterStateUpdateRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Settings} to update
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Licensed to ElasticSearch and Shay Banon 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.cluster.ack;
|
||||
|
||||
/**
|
||||
* Base cluster state update request that allows to execute update against multiple indices
|
||||
*/
|
||||
public abstract class IndicesClusterStateUpdateRequest<T extends IndicesClusterStateUpdateRequest<T>> extends ClusterStateUpdateRequest<T> {
|
||||
|
||||
private String[] indices;
|
||||
|
||||
/**
|
||||
* Returns the indices the operation needs to be executed on
|
||||
*/
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the indices the operation needs to be executed on
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return (T)this;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue