diff --git a/docs/reference/indices/analyze.asciidoc b/docs/reference/indices/analyze.asciidoc index ee8b856ef41..5516d898813 100644 --- a/docs/reference/indices/analyze.asciidoc +++ b/docs/reference/indices/analyze.asciidoc @@ -181,4 +181,5 @@ The request returns the following result: } } -------------------------------------------------- +// TESTRESPONSE <1> Output only "keyword" attribute, since specify "attributes" in the request. diff --git a/docs/reference/indices/clearcache.asciidoc b/docs/reference/indices/clearcache.asciidoc index 8ebb9e3488a..6a7240dc958 100644 --- a/docs/reference/indices/clearcache.asciidoc +++ b/docs/reference/indices/clearcache.asciidoc @@ -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/] diff --git a/docs/reference/indices/delete-index.asciidoc b/docs/reference/indices/delete-index.asciidoc index 5c652accfb9..bc057e155d0 100644 --- a/docs/reference/indices/delete-index.asciidoc +++ b/docs/reference/indices/delete-index.asciidoc @@ -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. diff --git a/docs/reference/indices/forcemerge.asciidoc b/docs/reference/indices/forcemerge.asciidoc index a33b7fdfe2c..26baf214176 100644 --- a/docs/reference/indices/forcemerge.asciidoc +++ b/docs/reference/indices/forcemerge.asciidoc @@ -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/] diff --git a/docs/reference/indices/get-field-mapping.asciidoc b/docs/reference/indices/get-field-mapping.asciidoc index 39667dc0874..224e74605f4 100644 --- a/docs/reference/indices/get-field-mapping.asciidoc +++ b/docs/reference/indices/get-field-mapping.asciidoc @@ -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": { - "tweet": { - "text": { - "full_name": "text", - "mapping": { - "text": { "type": "text" } + "mappings": { + "tweet": { + "message": { + "full_name": "message", + "mapping": { + "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 diff --git a/docs/reference/indices/get-index.asciidoc b/docs/reference/indices/get-index.asciidoc index b82bee05630..772318c71d8 100644 --- a/docs/reference/indices/get-index.asciidoc +++ b/docs/reference/indices/get-index.asciidoc @@ -1,12 +1,14 @@ [[indices-get-index]] == Get Index -The get index API allows to retrieve information about one or more indexes. +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. @@ -17,13 +19,15 @@ all indices by using `_all` or `*` as index. [float] === Filtering index information -The information returned by the get API can be filtered to include only specific features +The information returned by the get API can be filtered to include only specific features 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`. diff --git a/docs/reference/indices/get-mapping.asciidoc b/docs/reference/indices/get-mapping.asciidoc index 317a708f13a..c3580917d9a 100644 --- a/docs/reference/indices/get-mapping.asciidoc +++ b/docs/reference/indices/get-mapping.asciidoc @@ -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] diff --git a/docs/reference/indices/get-settings.asciidoc b/docs/reference/indices/get-settings.asciidoc index 4689c448b56..60d7a75a861 100644 --- a/docs/reference/indices/get-settings.asciidoc +++ b/docs/reference/indices/get-settings.asciidoc @@ -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 diff --git a/docs/reference/indices/open-close.asciidoc b/docs/reference/indices/open-close.asciidoc index afdab7bedaf..59f36112b4e 100644 --- a/docs/reference/indices/open-close.asciidoc +++ b/docs/reference/indices/open-close.asciidoc @@ -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 diff --git a/docs/reference/indices/recovery.asciidoc b/docs/reference/indices/recovery.asciidoc index c4aabac3ac3..448c423d0b6 100644 --- a/docs/reference/indices/recovery.asciidoc +++ b/docs/reference/indices/recovery.asciidoc @@ -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.