Add CONSOLE to more docs

Relates to #18160
This commit is contained in:
Nik Everett 2016-09-01 17:08:18 -04:00
parent 5fe4cb6adc
commit c8b984aee9
3 changed files with 45 additions and 26 deletions

View File

@ -65,18 +65,18 @@ buildRestTests.docs = fileTree(projectDir) {
Closure setupTwitter = { String name, int count ->
buildRestTests.setups[name] = '''
- do:
indices.create:
index: twitter
body:
settings:
number_of_shards: 1
number_of_replicas: 1
indices.create:
index: twitter
body:
settings:
number_of_shards: 1
number_of_replicas: 1
- do:
bulk:
index: twitter
type: tweet
refresh: true
body: |'''
bulk:
index: twitter
type: tweet
refresh: true
body: |'''
for (int i = 0; i < count; i++) {
String user, text
if (i == 0) {
@ -87,12 +87,13 @@ Closure setupTwitter = { String name, int count ->
text = "some message with the number $i"
}
buildRestTests.setups[name] += """
{"index":{"_id": "$i"}}
{"user": "$user", "message": "$text", "date": "2009-11-15T14:12:12", "likes": $i}"""
{"index":{"_id": "$i"}}
{"user": "$user", "message": "$text", "date": "2009-11-15T14:12:12", "likes": $i}"""
}
}
setupTwitter('twitter', 5)
setupTwitter('big_twitter', 120)
setupTwitter('huge_twitter', 1200)
buildRestTests.setups['host'] = '''
# Fetch the http host. We use the host of the master because we know there will always be a master.

View File

@ -9,8 +9,10 @@ refresh is scheduled periodically.
[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/twitter/_refresh'
POST /twitter/_refresh
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
[float]
=== Multi Index
@ -20,7 +22,9 @@ call, or even on `_all` the indices.
[source,js]
--------------------------------------------------
$ curl -XPOST 'http://localhost:9200/kimchy,elasticsearch/_refresh'
POST /kimchy,elasticsearch/_refresh
$ curl -XPOST 'http://localhost:9200/_refresh'
POST /_refresh
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]

View File

@ -19,7 +19,9 @@ PUT /logs-000001 <1>
}
}
POST logs_write/_rollover <2>
# Add > 1000 documents to logs-000001
POST /logs_write/_rollover <2>
{
"conditions": {
"max_age": "7d",
@ -28,6 +30,8 @@ POST logs_write/_rollover <2>
}
--------------------------------------------------
// CONSOLE
// TEST[setup:huge_twitter]
// TEST[s/# Add > 1000 documents to logs-000001/POST _reindex?refresh\n{"source":{"index":"twitter"},"dest":{"index":"logs-000001"}}/]
<1> Creates an index called `logs-0000001` with the alias `logs_write`.
<2> If the index pointed to by `logs_write` was created 7 or more days ago, or
contains 1,000 or more documents, then the `logs-0002` index is created
@ -38,6 +42,8 @@ The above request might return the following response:
[source,js]
--------------------------------------------------
{
"acknowledged": true,
"shards_acknowledged": true,
"old_index": "logs-000001",
"new_index": "logs-000002",
"rolled_over": true, <1>
@ -48,6 +54,7 @@ The above request might return the following response:
}
}
--------------------------------------------------
// TESTRESPONSE
<1> Whether the index was rolled over.
<2> Whether the rollover was dry run.
<3> The result of each condition.
@ -65,9 +72,16 @@ the new index as follows:
[source,js]
--------------------------------------------------
POST my_alias/_rollover/my_new_index_name
{...}
POST /my_alias/_rollover/my_new_index_name
{
"conditions": {
"max_age": "7d",
"max_docs": 1000
}
}
--------------------------------------------------
// CONSOLE
// TEST[s/^/PUT my_old_index_name\nPUT my_old_index_name\/_alias\/my_alias\n/]
[float]
=== Defining the new index
@ -88,7 +102,7 @@ PUT /logs-000001
}
}
POST logs_write/_rollover
POST /logs_write/_rollover
{
"conditions" : {
"max_age": "7d",
@ -116,7 +130,7 @@ PUT /logs-000001
}
}
POST logs_write/_rollover?dry_run
POST /logs_write/_rollover?dry_run
{
"conditions" : {
"max_age": "7d",