浏览代码

CONSOLEify some more Indices APIs (#24375)

* CONSOLEify doc testing for some more Indices APIs

Related to #18160
Zachary Tong 8 年之前
父节点
当前提交
38273709b5

+ 0 - 3
docs/build.gradle

@@ -54,9 +54,6 @@ buildRestTests.expectedUnconvertedCandidates = [
   'reference/index-modules/similarity.asciidoc',
   'reference/index-modules/store.asciidoc',
   'reference/index-modules/translog.asciidoc',
-  'reference/indices/flush.asciidoc',
-  'reference/indices/get-settings.asciidoc',
-  'reference/indices/put-mapping.asciidoc',
   'reference/indices/recovery.asciidoc',
   'reference/indices/segments.asciidoc',
   'reference/indices/shard-stores.asciidoc',

+ 26 - 19
docs/reference/indices/flush.asciidoc

@@ -74,10 +74,11 @@ the <<indices-stats,indices stats>> API:
 
 [source,sh]
 --------------------------------------------------
-GET twitter/_stats?level=shards
+GET twitter/_stats?filter_path=**.commit&level=shards <1>
 --------------------------------------------------
 // CONSOLE
 // TEST[s/^/PUT twitter\n/]
+<1> `filter_path` is used to reduce the verbosity of the response, but is entirely optional
 
 
 which returns something similar to:
@@ -85,35 +86,40 @@ which returns something similar to:
 [source,js]
 --------------------------------------------------
 {
-   ...
    "indices": {
       "twitter": {
-         "primaries": {},
-         "total": {},
          "shards": {
             "0": [
                {
-                  "routing": {
-                     ...
-                  },
-                  "commit": {
-                     "id": "te7zF7C4UsirqvL6jp/vUg==",
-                     "generation": 2,
-                     "user_data": {
-                        "sync_id": "AU2VU0meX-VX2aNbEUsD" <1>,
-                        ...
-                     },
-                     "num_docs": 0
-                  }
+                 "commit" : {
+                   "id" : "3M3zkw2GHMo2Y4h4/KFKCg==",
+                   "generation" : 1,
+                   "user_data" : {
+                     "translog_uuid" : "hnOG3xFcTDeoI_kvvvOdNA",
+                     "local_checkpoint" : "-1",
+                     "translog_generation" : "1",
+                     "max_seq_no" : "-1",
+                     "max_unsafe_auto_id_timestamp" : "-1"
+                   },
+                   "num_docs" : 0
+                 }
                }
-               ...
             ],
-            ...
+            "1": ...,
+            "2": ...,
+            "3": ...,
+            "4": ...
          }
       }
    }
 }
 --------------------------------------------------
+// TESTRESPONSE[s/"id" : "3M3zkw2GHMo2Y4h4\/KFKCg=="/"id": $body.indices.twitter.shards.0.0.commit.id/]
+// TESTRESPONSE[s/"translog_uuid" : "hnOG3xFcTDeoI_kvvvOdNA"/"translog_uuid": $body.indices.twitter.shards.0.0.commit.user_data.translog_uuid/]
+// TESTRESPONSE[s/"1": \.\.\./"1": $body.indices.twitter.shards.1/]
+// TESTRESPONSE[s/"2": \.\.\./"2": $body.indices.twitter.shards.2/]
+// TESTRESPONSE[s/"3": \.\.\./"3": $body.indices.twitter.shards.3/]
+// TESTRESPONSE[s/"4": \.\.\./"4": $body.indices.twitter.shards.4/]
 <1> the `sync id` marker
 
 [float]
@@ -189,6 +195,7 @@ Here is what it looks like when one shard group failed due to pending operations
    }
 }
 --------------------------------------------------
+// NOTCONSOLE
 
 NOTE: The above error is shown when the synced flush fails due to concurrent indexing operations. The HTTP
 status code in that case will be `409 CONFLICT`.
@@ -225,7 +232,7 @@ fast recovery but those that succeeded still will be. This case is reported as f
    }
 }
 --------------------------------------------------
-
+// NOTCONSOLE
 
 NOTE: When a shard copy fails to sync-flush, the HTTP status code returned will be `409 CONFLICT`.
 

+ 3 - 1
docs/reference/indices/get-settings.asciidoc

@@ -40,5 +40,7 @@ as follows:
 
 [source,js]
 --------------------------------------------------
-curl -XGET 'http://localhost:9200/2013-*/_settings/index.number_*'
+GET /log_2013_-*/_settings/index.number_*
 --------------------------------------------------
+// CONSOLE
+// TEST[continued]

+ 16 - 7
docs/reference/indices/put-mapping.asciidoc

@@ -52,17 +52,26 @@ More information on how to define type mappings can be found in the
 === Multi-index
 
 The PUT mapping API can be applied to multiple indices with a single request.
-It has the following format:
+For example, we can update the `twitter-1` and `twitter-2` mappings at the same time:
 
 [source,js]
 --------------------------------------------------
-PUT /{index}/_mapping/{type}
-{ body }
---------------------------------------------------
+# Create the two indices
+PUT twitter-1
+PUT twitter-2
 
-* `{index}` accepts <<multi-index,multiple index names>> and wildcards.
-* `{type}` is the name of the type to update.
-* `{body}` contains the mapping changes that should be applied.
+# Update both mappings
+PUT /twitter-1,twitter-2/_mapping/my_type <1>
+{
+  "properties": {
+    "user_name": {
+      "type": "text"
+    }
+  }
+}
+--------------------------------------------------
+// CONSOLE
+<1> Note that the indices specified (`twitter-1,twitter-2`) follows <<multi-index,multiple index names>> and wildcard format.
 
 
 NOTE: When updating the `_default_` mapping with the