Skip to content

Commit

Permalink
[DOCS] Replace twitter dataset in docs APIs (#60521)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig authored Jul 31, 2020
1 parent aec26b1 commit 724f706
Show file tree
Hide file tree
Showing 15 changed files with 282 additions and 259 deletions.
66 changes: 33 additions & 33 deletions docs/reference/docs/delete-by-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Deletes documents that match the specified query.

[source,console]
--------------------------------------------------
POST /twitter/_delete_by_query
POST /my-index-000001/_delete_by_query
{
"query": {
"match": {
"message": "some message"
"user.id": "elkbee"
}
}
}
--------------------------------------------------
// TEST[setup:big_twitter]
// TEST[setup:my_index_big]

////
Expand Down Expand Up @@ -250,16 +250,16 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards
[source,console]
--------------------------------------------------
POST /twitter/_delete_by_query
POST /my-index-000001/_delete_by_query
{
"query": { <1>
"match": {
"message": "some message"
"user.id": "elkbee"
}
}
}
--------------------------------------------------
// TEST[setup:big_twitter]
// TEST[setup:my_index_big]
//////////////////////////

Expand Down Expand Up @@ -350,38 +350,38 @@ version conflicts.
[[docs-delete-by-query-api-example]]
==== {api-examples-title}

Delete all tweets from the `twitter` data stream or index:
Delete all documents from the `my-index-000001` data stream or index:

[source,console]
--------------------------------------------------
POST twitter/_delete_by_query?conflicts=proceed
POST my-index-000001/_delete_by_query?conflicts=proceed
{
"query": {
"match_all": {}
}
}
--------------------------------------------------
// TEST[setup:twitter]
// TEST[setup:my_index]

Delete documents from multiple data streams or indices:

[source,console]
--------------------------------------------------
POST /twitter,blog/_delete_by_query
POST /my-index-000001,my-index-000002/_delete_by_query
{
"query": {
"match_all": {}
}
}
--------------------------------------------------
// TEST[s/^/PUT twitter\nPUT blog\n/]
// TEST[s/^/PUT my-index-000001\nPUT my-index-000002\n/]

Limit the delete by query operation to shards that a particular routing
value:

[source,console]
--------------------------------------------------
POST twitter/_delete_by_query?routing=1
POST my-index-000001/_delete_by_query?routing=1
{
"query": {
"range" : {
Expand All @@ -392,23 +392,23 @@ POST twitter/_delete_by_query?routing=1
}
}
--------------------------------------------------
// TEST[setup:twitter]
// TEST[setup:my_index]

By default `_delete_by_query` uses scroll batches of 1000. You can change the
batch size with the `scroll_size` URL parameter:

[source,console]
--------------------------------------------------
POST twitter/_delete_by_query?scroll_size=5000
POST my-index-000001/_delete_by_query?scroll_size=5000
{
"query": {
"term": {
"user": "kimchy"
"user.id": "kimchy"
}
}
}
--------------------------------------------------
// TEST[setup:twitter]
// TEST[setup:my_index]

[discrete]
[[docs-delete-by-query-manual-slice]]
Expand All @@ -419,48 +419,48 @@ slices:

[source,console]
----------------------------------------------------------------
POST twitter/_delete_by_query
POST my-index-000001/_delete_by_query
{
"slice": {
"id": 0,
"max": 2
},
"query": {
"range": {
"likes": {
"lt": 10
"http.response.bytes": {
"lt": 2000000
}
}
}
}
POST twitter/_delete_by_query
POST my-index-000001/_delete_by_query
{
"slice": {
"id": 1,
"max": 2
},
"query": {
"range": {
"likes": {
"lt": 10
"http.response.bytes": {
"lt": 2000000
}
}
}
}
----------------------------------------------------------------
// TEST[setup:big_twitter]
// TEST[setup:my_index_big]

Which you can verify works with:

[source,console]
----------------------------------------------------------------
GET _refresh
POST twitter/_search?size=0&filter_path=hits.total
POST my-index-000001/_search?size=0&filter_path=hits.total
{
"query": {
"range": {
"likes": {
"lt": 10
"http.response.bytes": {
"lt": 2000000
}
}
}
Expand Down Expand Up @@ -492,29 +492,29 @@ the number of slices to use:

[source,console]
----------------------------------------------------------------
POST twitter/_delete_by_query?refresh&slices=5
POST my-index-000001/_delete_by_query?refresh&slices=5
{
"query": {
"range": {
"likes": {
"lt": 10
"http.response.bytes": {
"lt": 2000000
}
}
}
}
----------------------------------------------------------------
// TEST[setup:big_twitter]
// TEST[setup:my_index_big]

Which you also can verify works with:

[source,console]
----------------------------------------------------------------
POST twitter/_search?size=0&filter_path=hits.total
POST my-index-000001/_search?size=0&filter_path=hits.total
{
"query": {
"range": {
"likes": {
"lt": 10
"http.response.bytes": {
"lt": 2000000
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions docs/reference/docs/delete.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Example to delete with routing
[source,console]
--------------------------------------------------
PUT /twitter/_doc/1?routing=kimchy
PUT /my-index-000001/_doc/1?routing=kimchy
{
"test": "test"
}
Expand All @@ -73,11 +73,11 @@ PUT /twitter/_doc/1?routing=kimchy

[source,console]
--------------------------------------------------
DELETE /twitter/_doc/1?routing=kimchy
DELETE /my-index-000001/_doc/1?routing=kimchy
--------------------------------------------------
// TEST[continued]

This request deletes the tweet with id `1`, but it is routed based on the
This request deletes the document with id `1`, but it is routed based on the
user. The document is not deleted if the correct routing is not specified.

[discrete]
Expand Down Expand Up @@ -129,9 +129,9 @@ to 5 minutes:

[source,console]
--------------------------------------------------
DELETE /twitter/_doc/1?timeout=5m
DELETE /my-index-000001/_doc/1?timeout=5m
--------------------------------------------------
// TEST[setup:twitter]
// TEST[setup:my_index]

[[docs-delete-api-path-params]]
==== {api-path-parms-title}
Expand Down Expand Up @@ -166,13 +166,13 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards
[[docs-delete-api-example]]
==== {api-examples-title}

Delete the JSON document `1` from the `twitter` index:
Delete the JSON document `1` from the `my-index-000001` index:

[source,console]
--------------------------------------------------
DELETE /twitter/_doc/1
DELETE /my-index-000001/_doc/1
--------------------------------------------------
// TEST[setup:twitter]
// TEST[setup:my_index]

The API returns the following result:

Expand All @@ -184,7 +184,7 @@ The API returns the following result:
"failed": 0,
"successful": 2
},
"_index": "twitter",
"_index": "my-index-000001",
"_id": "1",
"_version": 2,
"_primary_term": 1,
Expand Down
Loading

0 comments on commit 724f706

Please sign in to comment.