Add CONSOLE to a few snippets in reference docs

This allows them to be run in Console and adds them to the list of
docs that are automatically tested as part of the build.

Relates to #18160
This commit is contained in:
Nik Everett 2016-09-01 13:05:22 -04:00
parent 0e8a43e826
commit 4b219d15d2
10 changed files with 87 additions and 39 deletions

View File

@ -181,4 +181,5 @@ The request returns the following result:
}
}
--------------------------------------------------
// TESTRESPONSE
<1> Output only "keyword" attribute, since specify "attributes" in the request.

View File

@ -6,8 +6,10 @@ associated with one or more indices.
[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/twitter/_cache/clear'
POST /twitter/_cache/clear
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
The API, by default, will clear all caches. Specific caches can be cleaned
explicitly by setting `query`, `fielddata` or `request`.
@ -24,8 +26,9 @@ call, or even on `_all` the indices.
[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/kimchy,elasticsearch/_cache/clear'
POST /kimchy,elasticsearch/_cache/clear
$ curl -XPOST 'http://localhost:9200/_cache/clear'
POST /_cache/clear
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]

View File

@ -5,8 +5,10 @@ The delete index API allows to delete an existing index.
[source,js]
--------------------------------------------------
$ curl -XDELETE 'http://localhost:9200/twitter/'
DELETE /twitter
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
The above example deletes an index called `twitter`. Specifying an index,
alias or wildcard expression is required.

View File

@ -12,8 +12,10 @@ block until the previous force merge is complete.
[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/twitter/_forcemerge'
POST /twitter/_forcemerge
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
[float]
[[forcemerge-parameters]]
@ -45,7 +47,9 @@ even on `_all` the indices.
[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/kimchy,elasticsearch/_forcemerge'
POST /kimchy,elasticsearch/_forcemerge
$ curl -XPOST 'http://localhost:9200/_forcemerge'
POST /_forcemerge
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]

View File

@ -9,8 +9,10 @@ The following returns the mapping of the field `text` only:
[source,js]
--------------------------------------------------
curl -XGET 'http://localhost:9200/twitter/_mapping/tweet/field/text'
GET /twitter/_mapping/tweet/field/message
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
For which the response is (assuming `text` is a default string field):
@ -18,18 +20,28 @@ For which the response is (assuming `text` is a default string field):
--------------------------------------------------
{
"twitter": {
"mappings": {
"tweet": {
"text": {
"full_name": "text",
"message": {
"full_name": "message",
"mapping": {
"text": { "type": "text" }
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
}
--------------------------------------------------
// TESTRESPONSE
[float]
@ -44,12 +56,15 @@ following are some examples:
[source,js]
--------------------------------------------------
curl -XGET 'http://localhost:9200/twitter,kimchy/_mapping/field/message'
GET /twitter,kimchy/_mapping/field/message
curl -XGET 'http://localhost:9200/_all/_mapping/tweet,book/field/message,user.id'
GET /_all/_mapping/tweet,book/field/message,user.id
curl -XGET 'http://localhost:9200/_all/_mapping/tw*/field/*.id'
GET /_all/_mapping/tw*/field/*.id
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
// TEST[s/^/PUT kimchy\nPUT book\n/]
[float]
=== Specifying fields

View File

@ -5,8 +5,10 @@ The get index API allows to retrieve information about one or more indexes.
[source,js]
--------------------------------------------------
$ curl -XGET 'http://localhost:9200/twitter/'
GET /twitter
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
The above example gets the information for an index called `twitter`. Specifying an index,
alias or wildcard expression is required.
@ -22,8 +24,10 @@ by specifying a comma delimited list of features in the URL:
[source,js]
--------------------------------------------------
$ curl -XGET 'http://localhost:9200/twitter/_settings,_mappings'
GET twitter/_settings,_mappings
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
The above command will only return the settings and mappings for the index called `twitter`.

View File

@ -6,8 +6,10 @@ index/type.
[source,js]
--------------------------------------------------
curl -XGET 'http://localhost:9200/twitter/_mapping/tweet'
GET /twitter/_mapping/tweet
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
[float]
=== Multiple Indices and Types
@ -21,17 +23,21 @@ following are some examples:
[source,js]
--------------------------------------------------
curl -XGET 'http://localhost:9200/_mapping/twitter,kimchy'
GET /_mapping/tweet,kimchy
curl -XGET 'http://localhost:9200/_all/_mapping/tweet,book'
GET /_all/_mapping/tweet,book
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
If you want to get mappings of all indices and types then the following
two examples are equivalent:
[source,js]
--------------------------------------------------
curl -XGET 'http://localhost:9200/_all/_mapping'
GET /_all/_mapping
curl -XGET 'http://localhost:9200/_mapping'
GET /_mapping
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]

View File

@ -5,8 +5,10 @@ The get settings API allows to retrieve settings of index/indices:
[source,js]
--------------------------------------------------
$ curl -XGET 'http://localhost:9200/twitter/_settings'
GET /twitter/_settings
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
[float]
=== Multiple Indices and Types
@ -20,12 +22,15 @@ Wildcard expressions are also supported. The following are some examples:
[source,js]
--------------------------------------------------
curl -XGET 'http://localhost:9200/twitter,kimchy/_settings'
GET /twitter,kimchy/_settings
curl -XGET 'http://localhost:9200/_all/_settings'
GET /_all/_settings
curl -XGET 'http://localhost:9200/2013-*/_settings'
GET /log_2013_*/_settings
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
// TEST[s/^/PUT kimchy\nPUT log_2013_01_01\n/]
[float]
=== Filtering settings by name

View File

@ -12,10 +12,12 @@ example:
[source,js]
--------------------------------------------------
curl -XPOST 'localhost:9200/my_index/_close'
POST /my_index/_close
curl -XPOST 'localhost:9200/my_index/_open'
POST /my_index/_open
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT my_index\n/]
It is possible to open and close multiple indices. An error will be thrown
if the request explicitly refers to a missing index. This behaviour can be

View File

@ -8,15 +8,19 @@ For example, the following command would show recovery information for the indic
[source,js]
--------------------------------------------------
curl -XGET http://localhost:9200/index1,index2/_recovery
GET index1,index2/_recovery?human
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT index1\nPUT index2\n/]
To see cluster-wide recovery status simply leave out the index names.
[source,js]
--------------------------------------------------
curl -XGET http://localhost:9200/_recovery?pretty&human
GET /_recovery?human
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT index1\n{"settings": {"index.number_of_shards": 1}}\n/]
Response:
[source,js]
@ -30,7 +34,7 @@ Response:
"primary" : true,
"start_time" : "2014-02-24T12:15:59.716",
"start_time_in_millis": 1393244159716,
"total_time" : "2.9m"
"total_time" : "2.9m",
"total_time_in_millis" : 175576,
"source" : {
"repository" : "my_repository",
@ -45,7 +49,7 @@ Response:
},
"index" : {
"size" : {
"total" : "75.4mb"
"total" : "75.4mb",
"total_in_bytes" : 79063092,
"reused" : "0b",
"reused_in_bytes" : 0,
@ -68,7 +72,7 @@ Response:
"percent" : "100.0%",
"total_on_start" : 0,
"total_time" : "0s",
"total_time_in_millis" : 0
"total_time_in_millis" : 0,
},
"start" : {
"check_index_time" : "0s",
@ -80,6 +84,7 @@ Response:
}
}
--------------------------------------------------
// We should really assert that this is up to date but that is hard!
The above response shows a single index recovering a single shard. In this case, the source of the recovery is a snapshot repository
and the target of the recovery is the node with name "my_es_node".
@ -90,7 +95,7 @@ In some cases a higher level of detail may be preferable. Setting "detailed=true
[source,js]
--------------------------------------------------
curl -XGET http://localhost:9200/_recovery?pretty&human&detailed=true
GET _recovery?human&detailed=true
--------------------------------------------------
Response:
@ -170,6 +175,7 @@ Response:
}
}
--------------------------------------------------
// We should really assert that this is up to date but that is hard!
This response shows a detailed listing (truncated for brevity) of the actual files recovered and their sizes.