Browse Source

CONSOLEify some _cat docs

Added `// NOTCONSOLE` to some `_cat` docs that rely on `sort` or
are otherwise too difficult for us to test at this point.

Relates to #20717
Nik Everett 9 years ago
parent
commit
d7d5df8863

+ 0 - 3
docs/build.gradle

@@ -93,9 +93,6 @@ buildRestTests.expectedUnconvertedCandidates = [
   'reference/analysis/tokenfilters/stop-tokenfilter.asciidoc',
   'reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc',
   'reference/analysis/tokenfilters/word-delimiter-tokenfilter.asciidoc',
-  'reference/cat.asciidoc',
-  'reference/cat/alias.asciidoc',
-  'reference/cat/allocation.asciidoc',
   'reference/cat/count.asciidoc',
   'reference/cat/fielddata.asciidoc',
   'reference/cat/health.asciidoc',

+ 45 - 21
docs/reference/cat.asciidoc

@@ -25,46 +25,67 @@ the available commands.
 === Verbose
 
 Each of the commands accepts a query string parameter `v` to turn on
-verbose output.
+verbose output. For example:
 
-[source,sh]
+[source,js]
+--------------------------------------------------
+GET /_cat/master?v
+--------------------------------------------------
+// CONSOLE
+
+Might respond with:
+
+[source,js]
 --------------------------------------------------
-% curl 'localhost:9200/_cat/master?v'
-id                     ip        node
-EGtKWZlWQYWDmX29fUnp3Q 127.0.0.1 Grey, Sara
+id                     host      ip        node
+u_n93zwxThWHi1PDBJAGAg 127.0.0.1 127.0.0.1 u_n93zw
 --------------------------------------------------
+// TESTRESPONSE[s/u_n93zw(xThWHi1PDBJAGAg)?/.+/ _cat]
 
 [float]
 [[help]]
 === Help
 
 Each of the commands accepts a query string parameter `help` which will
-output its available columns.
+output its available columns. For example:
 
-[source,sh]
+[source,js]
 --------------------------------------------------
-% curl 'localhost:9200/_cat/master?help'
-id   | node id
-ip   | node transport ip address
-node | node name
+GET /_cat/master?help
 --------------------------------------------------
+// CONSOLE
+
+Might respond respond with:
+
+[source,js]
+--------------------------------------------------
+id   |   | node id
+host | h | host name
+ip   |   | ip address
+node | n | node name
+--------------------------------------------------
+// TESTRESPONSE[s/[|]/[|]/ _cat]
 
 [float]
 [[headers]]
 === Headers
 
 Each of the commands accepts a query string parameter `h` which forces
-only those columns to appear.
+only those columns to appear. For example:
 
-[source,sh]
+[source,js]
+--------------------------------------------------
+GET /_cat/nodes?h=ip,port,heapPercent,name
+--------------------------------------------------
+// CONSOLE
+
+Responds with:
+
+[source,js]
 --------------------------------------------------
-% curl 'n1:9200/_cat/nodes?h=ip,port,heapPercent,name'
-192.168.56.40 9300 40.3 bGG90GE
-192.168.56.20 9300 15.3 H5dfFeA
-192.168.56.50 9300 17.0 I8hydUG
-192.168.56.10 9300 12.3 DKDM97B
-192.168.56.30 9300 43.9 6-bjhwl
+127.0.0.1 9300 27 sLBaIGK
 --------------------------------------------------
+// TESTRESPONSE[s/9300 27 sLBaIGK/\\d+ \\d+ .+/ _cat]
 
 You can also request multiple columns using simple wildcards like
 `/_cat/thread_pool?h=ip,bulk.*` to get all headers (or aliases) starting
@@ -94,6 +115,7 @@ green wiki2 3 0 10000   0 105274918 105274918
 green wiki1 3 0 10000 413 103776272 103776272
 green foo   1 0   227   0   2065131   2065131
 --------------------------------------------------
+// NOTCONSOLE
 
 If you want to change the <<time-units,time units>>, use `time` parameter.
 
@@ -106,7 +128,7 @@ If you want to change the <<byte-units,byte units>>, use `bytes` parameter.
 
 [source,sh]
 --------------------------------------------------
-% curl '192.168.56.10:9200/_cat/indices?format=json' | jq .
+% curl 'localhost:9200/_cat/indices?format=json&pretty'
 [
   {
     "pri.store.size": "650b",
@@ -121,6 +143,7 @@ If you want to change the <<byte-units,byte units>>, use `bytes` parameter.
   }
 ]
 --------------------------------------------------
+// NOTCONSOLE
 
 Currently supported formats (for the `?format=` parameter):
 - text (default)
@@ -135,7 +158,7 @@ For example:
 
 [source,sh]
 --------------------------------------------------
-% curl '192.168.56.10:9200/_cat/indices' -H "Accept: application/json" | jq .
+% curl '192.168.56.10:9200/_cat/indices?pretty' -H "Accept: application/json"
 [
   {
     "pri.store.size": "650b",
@@ -150,6 +173,7 @@ For example:
   }
 ]
 --------------------------------------------------
+// NOTCONSOLE
 
 --
 

+ 41 - 5
docs/reference/cat/alias.asciidoc

@@ -4,19 +4,55 @@
 `aliases` shows information about currently configured aliases to indices
 including filter and routing infos.
 
-[source,sh]
+////
+Hidden setup for example:
+[source,js]
+--------------------------------------------------
+PUT test1
+{
+  "aliases": {
+    "alias1": {},
+    "alias2": {
+      "filter": {
+        "match": {
+          "user": "kimchy"
+        }
+      }
+    },
+    "alias3": {
+      "routing": "1"
+    },
+    "alias4": {
+      "index_routing": "2",
+      "search_routing": "1,2"
+    }
+  }
+}
+--------------------------------------------------
+// CONSOLE
+////
+
+[source,js]
+--------------------------------------------------
+GET /_cat/aliases?v
+--------------------------------------------------
+// CONSOLE
+// TEST[continued]
+
+Might respond with:
+
+[source,js]
 --------------------------------------------------
-% curl '192.168.56.10:9200/_cat/aliases?v'
 alias  index filter routing.index routing.search
-alias2 test1 *      -            -
-alias4 test1 -      2            1,2
 alias1 test1 -      -            -
+alias2 test1 *      -            -
 alias3 test1 -      1            1
+alias4 test1 -      2            1,2
 --------------------------------------------------
+// TESTRESPONSE[s/[*]/[*]/ _cat]
 
 The output shows that `alias` has configured a filter, and specific routing
 configurations in `alias3` and `alias4`.
 
 If you only want to get information about a single alias, you can specify
 the alias in the URL, for example `/_cat/aliases/alias1`.
-

+ 14 - 6
docs/reference/cat/allocation.asciidoc

@@ -4,14 +4,22 @@
 `allocation` provides a snapshot of how many shards are allocated to each data node
 and how much disk space they are using.
 
-[source,sh]
+[source,js]
 --------------------------------------------------
-% curl '192.168.56.10:9200/_cat/allocation?v'
-shards disk.indices disk.used disk.avail disk.total disk.percent host          ip            node
-     1        3.1gb     5.6gb     72.2gb     77.8gb          7.8 192.168.56.10 192.168.56.10 bGG90GE
-     1        3.1gb     5.6gb     72.2gb     77.8gb          7.8 192.168.56.30 192.168.56.30 I8hydUG
-     1        3.0gb     5.5gb     72.3gb     77.8gb          7.6 192.168.56.20 192.168.56.20 H5dfFeA
+GET /_cat/allocation?v
 --------------------------------------------------
+// CONSOLE
+// TEST[s/^/PUT test\n{"settings": {"number_of_replicas": 0}}\n/]
+
+Might respond with:
+
+[source,js]
+--------------------------------------------------
+shards disk.indices disk.used disk.avail disk.total disk.percent host      ip        node
+     5         260b    47.3gb     53.4gb    100.7gb           46 127.0.0.1 127.0.0.1 CSUXak2
+--------------------------------------------------
+// TESTRESPONSE[s/260b/\\d+b/ s/\\d+(\\.\\d+)?[tmk]b?/\\d+(\\.\\d+)?[tmk]b?/ s/46/\\d+/]
+// TESTRESPONSE[s/CSUXak2/.+/ _cat]
 
 Here we can see that each node has been allocated a single shard and
 that they're all using about the same amount of space.