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