parent
3120457bfe
commit
2a588dc1f1
|
@ -32,6 +32,8 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class ClusterStateRequest extends MasterNodeOperationRequest<ClusterStateRequest> {
|
public class ClusterStateRequest extends MasterNodeOperationRequest<ClusterStateRequest> {
|
||||||
|
|
||||||
|
public final static String NONE = "_na";
|
||||||
|
|
||||||
private boolean filterRoutingTable = false;
|
private boolean filterRoutingTable = false;
|
||||||
|
|
||||||
private boolean filterNodes = false;
|
private boolean filterNodes = false;
|
||||||
|
@ -104,6 +106,11 @@ public class ClusterStateRequest extends MasterNodeOperationRequest<ClusterState
|
||||||
return filteredIndices;
|
return filteredIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClusterStateRequest filterOutIndices() {
|
||||||
|
this.filteredIndices = new String[]{NONE};
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ClusterStateRequest filteredIndices(String... filteredIndices) {
|
public ClusterStateRequest filteredIndices(String... filteredIndices) {
|
||||||
this.filteredIndices = filteredIndices;
|
this.filteredIndices = filteredIndices;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -95,11 +95,13 @@ public class TransportClusterStateAction extends TransportMasterNodeOperationAct
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.filteredIndices().length > 0) {
|
if (request.filteredIndices().length > 0) {
|
||||||
String[] indices = currentState.metaData().concreteIndicesIgnoreMissing(request.filteredIndices());
|
if (!(request.filteredIndices().length == 1 && ClusterStateRequest.NONE.equals(request.filteredIndices()[0]))) {
|
||||||
for (String filteredIndex : indices) {
|
String[] indices = currentState.metaData().concreteIndicesIgnoreMissing(request.filteredIndices());
|
||||||
IndexMetaData indexMetaData = currentState.metaData().index(filteredIndex);
|
for (String filteredIndex : indices) {
|
||||||
if (indexMetaData != null) {
|
IndexMetaData indexMetaData = currentState.metaData().index(filteredIndex);
|
||||||
mdBuilder.put(indexMetaData, false);
|
if (indexMetaData != null) {
|
||||||
|
mdBuilder.put(indexMetaData, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class RestGetIndexTemplateAction extends BaseRestHandler {
|
||||||
.filterRoutingTable(true)
|
.filterRoutingTable(true)
|
||||||
.filterNodes(true)
|
.filterNodes(true)
|
||||||
.filteredIndexTemplates(request.param("name"))
|
.filteredIndexTemplates(request.param("name"))
|
||||||
.filteredIndices("_na");
|
.filterOutIndices();
|
||||||
|
|
||||||
clusterStateRequest.listenerThreaded(false);
|
clusterStateRequest.listenerThreaded(false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue