From 38273709b5009263c580335b978a454297e5303a Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Mon, 1 May 2017 13:56:39 -0400 Subject: [PATCH] CONSOLEify some more Indices APIs (#24375) * CONSOLEify doc testing for some more Indices APIs Related to #18160 --- docs/build.gradle | 3 -- docs/reference/indices/flush.asciidoc | 45 +++++++++++--------- docs/reference/indices/get-settings.asciidoc | 4 +- docs/reference/indices/put-mapping.asciidoc | 23 +++++++--- 4 files changed, 45 insertions(+), 30 deletions(-) diff --git a/docs/build.gradle b/docs/build.gradle index 98d10831707..7effa7401b0 100644 --- a/docs/build.gradle +++ b/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', diff --git a/docs/reference/indices/flush.asciidoc b/docs/reference/indices/flush.asciidoc index 2b9f519e17c..d327d0da09d 100644 --- a/docs/reference/indices/flush.asciidoc +++ b/docs/reference/indices/flush.asciidoc @@ -74,10 +74,11 @@ the <> 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`. diff --git a/docs/reference/indices/get-settings.asciidoc b/docs/reference/indices/get-settings.asciidoc index 5fb488f49c3..fe539b5cad0 100644 --- a/docs/reference/indices/get-settings.asciidoc +++ b/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] \ No newline at end of file diff --git a/docs/reference/indices/put-mapping.asciidoc b/docs/reference/indices/put-mapping.asciidoc index 0dd2ffc3d8a..5fc4f0d9cc0 100644 --- a/docs/reference/indices/put-mapping.asciidoc +++ b/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 <> 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 <> and wildcard format. NOTE: When updating the `_default_` mapping with the