Browse Source

Filtered out non data-nodes in relevant cat api

Closes #9214
Closes #9287
Nirmal Chidambaram 10 years ago
parent
commit
931b9f9c74

+ 1 - 1
core/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java

@@ -58,7 +58,7 @@ public class RestAllocationAction extends AbstractCatAction {
 
     @Override
     public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
-        final String[] nodes = Strings.splitStringByCommaToArray(request.param("nodes"));
+        final String[] nodes = Strings.splitStringByCommaToArray(request.param("nodes", "data:true"));
         final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
         clusterStateRequest.clear().routingTable(true);
         clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

+ 1 - 1
core/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java

@@ -55,7 +55,7 @@ public class RestFielddataAction extends AbstractCatAction {
     @Override
     void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
 
-        final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
+        final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
         nodesStatsRequest.clear();
         nodesStatsRequest.indices(true);
         String[] fields = request.paramAsStringArray("fields", null);

+ 2 - 2
docs/reference/cat/allocation.asciidoc

@@ -1,8 +1,8 @@
 [[cat-allocation]]
 == cat allocation
 
-`allocation` provides a snapshot of how shards have located around the
-cluster and the state of disk usage.
+`allocation` provides a snapshot of how many shards are allocated to each data node
+and how much disk space they are using.
 
 [source,shell]
 --------------------------------------------------

+ 2 - 2
docs/reference/cat/fielddata.asciidoc

@@ -1,8 +1,8 @@
 [[cat-fielddata]]
 == cat fielddata
 
-`fielddata` shows information about currently loaded fielddata on a per-node
-basis.
+`fielddata` shows how much heap memory is currently being used by fielddata 
+on every data node in the cluster.
 
 [source,shell]
 --------------------------------------------------

+ 40 - 9
rest-api-spec/test/cat.allocation/10_basic.yaml

@@ -61,9 +61,9 @@
               ( \s*                          #allow leading spaces to account for right-justified text
                 \d+                    \s+
                 \d+(\.\d+)?[kmgt]?b    \s+
-                (\d+(\.\d+)?[kmgt]b   \s+)?  #no value from client nodes
-                (\d+(\.\d+)?[kmgt]b   \s+)?  #no value from client nodes
-                (\d+                  \s+)?  #no value from client nodes
+                (\d+(\.\d+)?[kmgt]b   \s+)  #always should return value since we filter out non data nodes by default
+                (\d+(\.\d+)?[kmgt]b   \s+)  #always should return value since we filter out non data nodes by default
+                (\d+                  \s+)  #always should return value since we filter out non data nodes by default
                 [-\w.]+                \s+
                 \d+(\.\d+){3}          \s+
                 \w.*
@@ -110,6 +110,37 @@
             /^
             $/
 
+---
+
+"All Nodes":
+
+   - do:
+         cat.allocation:
+           node_id: "*"
+           v: false
+
+   - match:
+       $body: |
+             /^
+               ( \s*                          #allow leading spaces to account for right-justified text
+                 \d+                    \s+
+                 \d+(\.\d+)?[kmgt]?b    \s+
+                 (\d+(\.\d+)?[kmgt]b   \s+)?  #no value from client nodes
+                 (\d+(\.\d+)?[kmgt]b   \s+)?  #no value from client nodes
+                 (\d+                  \s+)?  #no value from client nodes
+                 [-\w.]+                \s+
+                 \d+(\.\d+){3}          \s+
+                 \w.*
+                 \n
+               )+
+               (
+                 \s*                          #allow leading spaces to account for right-justified text
+                 \d+                    \s+
+                 UNASSIGNED             \s+
+                 \n
+               )?
+             $/
+
 ---
 "Column headers":
 
@@ -132,9 +163,9 @@
               ( \s*                          #allow leading spaces to account for right-justified text
                 0                      \s+
                 \d+(\.\d+)?[kmgt]?b    \s+
-                (\d+(\.\d+)?[kmgt]b   \s+)?  #no value from client nodes
-                (\d+(\.\d+)?[kmgt]b   \s+)?  #no value from client nodes
-                (\d+                  \s+)?  #no value from client nodes
+                (\d+(\.\d+)?[kmgt]b   \s+)  #always should return value since we filter out non data nodes by default
+                (\d+(\.\d+)?[kmgt]b   \s+)  #always should return value since we filter out non data nodes by default
+                (\d+                  \s+)  #always should return value since we filter out non data nodes by default
                 [-\w.]+                \s+
                 \d+(\.\d+){3}          \s+
                 \w.*
@@ -192,9 +223,9 @@
             /^
               ( 0                   \s+
                 \d+                 \s+
-                (\d+                 \s+)?  #no value from client nodes
-                (\d+                 \s+)?  #no value from client nodes
-                (\d+                 \s+)?  #no value from client nodes
+                (\d+                 \s+)  #always should return value since we filter out non data nodes by default
+                (\d+                 \s+)  #always should return value since we filter out non data nodes by default
+                (\d+                 \s+)  #always should return value since we filter out non data nodes by default
                 [-\w.]+             \s+
                 \d+(\.\d+){3}       \s+
                 \w.*