Skip to content

Commit 84996e5

Browse files
committed
Revert "[DOCS] Reformat doc delete API reference. (#45422)"
This reverts commit d4e676b.
1 parent f2c5450 commit 84996e5

File tree

2 files changed

+54
-103
lines changed

2 files changed

+54
-103
lines changed

docs/reference/docs/delete.asciidoc

Lines changed: 54 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,53 @@
11
[[docs-delete]]
22
=== Delete API
3-
++++
4-
<titleabbrev>Delete</titleabbrev>
5-
++++
63

7-
Removes a JSON document from the specified index.
4+
The delete API allows to delete a JSON document from a specific
5+
index based on its id. The following example deletes the JSON document
6+
from an index called `twitter` with ID `1`:
87

9-
[[docs-delete-api-request]]
10-
==== {api-request-title}
11-
12-
`DELETE /<index>/_doc/<_id>`
8+
[source,js]
9+
--------------------------------------------------
10+
DELETE /twitter/_doc/1
11+
--------------------------------------------------
12+
// CONSOLE
13+
// TEST[setup:twitter]
1314

14-
[[docs-delete-api-desc]]
15-
==== {api-description-title}
15+
The result of the above delete operation is:
1616

17-
You use DELETE to remove a document from an index. You must specify the
18-
index name and document ID.
17+
[source,js]
18+
--------------------------------------------------
19+
{
20+
"_shards" : {
21+
"total" : 2,
22+
"failed" : 0,
23+
"successful" : 2
24+
},
25+
"_index" : "twitter",
26+
"_type" : "_doc",
27+
"_id" : "1",
28+
"_version" : 2,
29+
"_primary_term": 1,
30+
"_seq_no": 5,
31+
"result": "deleted"
32+
}
33+
--------------------------------------------------
34+
// TESTRESPONSE[s/"successful" : 2/"successful" : 1/]
35+
// TESTRESPONSE[s/"_primary_term" : 1/"_primary_term" : $body._primary_term/]
36+
// TESTRESPONSE[s/"_seq_no" : 5/"_seq_no" : $body._seq_no/]
1937

2038
[float]
2139
[[optimistic-concurrency-control-delete]]
22-
===== Optimistic concurrency control
40+
==== Optimistic concurrency control
2341

2442
Delete operations can be made conditional and only be performed if the last
25-
modification to the document was assigned the sequence number and primary
43+
modification to the document was assigned the sequence number and primary
2644
term specified by the `if_seq_no` and `if_primary_term` parameters. If a
2745
mismatch is detected, the operation will result in a `VersionConflictException`
28-
and a status code of 409. See <<optimistic-concurrency-control>> for more details.
46+
and a status code of 409. See <<optimistic-concurrency-control>> for more details.
2947

3048
[float]
3149
[[delete-versioning]]
32-
===== Versioning
50+
==== Versioning
3351

3452
Each document indexed is versioned. When deleting a document, the `version` can
3553
be specified to make sure the relevant document we are trying to delete is
@@ -42,17 +60,11 @@ determined by the `index.gc_deletes` index setting and defaults to 60 seconds.
4260

4361
[float]
4462
[[delete-routing]]
45-
===== Routing
46-
47-
If routing is used during indexing, the routing value also needs to be
48-
specified to delete a document.
49-
50-
If the `_routing` mapping is set to `required` and no routing value is
51-
specified, the delete API throws a `RoutingMissingException` and rejects
52-
the request.
53-
54-
For example:
63+
==== Routing
5564

65+
When indexing using the ability to control the routing, in order to
66+
delete a document, the routing value should also be provided. For
67+
example:
5668

5769
////
5870
Example to delete with routing
@@ -75,29 +87,34 @@ DELETE /twitter/_doc/1?routing=kimchy
7587
// CONSOLE
7688
// TEST[continued]
7789

78-
This request deletes the tweet with id `1`, but it is routed based on the
79-
user. The document is not deleted if the correct routing is not specified.
90+
The above will delete a tweet with id `1`, but will be routed based on the
91+
user. Note that issuing a delete without the correct routing will cause the
92+
document to not be deleted.
93+
94+
When the `_routing` mapping is set as `required` and no routing value is
95+
specified, the delete API will throw a `RoutingMissingException` and reject
96+
the request.
8097

8198
[float]
8299
[[delete-index-creation]]
83-
===== Automatic index creation
100+
==== Automatic index creation
84101

85102
If an <<docs-index_,external versioning variant>> is used,
86-
the delete operation automatically creates the specified index if it does not
87-
exist. For information about manually creating indices, see
88-
<<indices-create-index,create index API>>.
103+
the delete operation automatically creates an index if it has not been
104+
created before (check out the <<indices-create-index,create index API>>
105+
for manually creating an index).
89106

90107
[float]
91108
[[delete-distributed]]
92-
===== Distributed
109+
==== Distributed
93110

94111
The delete operation gets hashed into a specific shard id. It then gets
95112
redirected into the primary shard within that id group, and replicated
96113
(if needed) to shard replicas within that id group.
97114

98115
[float]
99116
[[delete-wait-for-active-shards]]
100-
===== Wait for active shards
117+
==== Wait For Active Shards
101118

102119
When making delete requests, you can set the `wait_for_active_shards`
103120
parameter to require a minimum number of shard copies to be active
@@ -107,14 +124,15 @@ example.
107124

108125
[float]
109126
[[delete-refresh]]
110-
===== Refresh
127+
==== Refresh
111128

112129
Control when the changes made by this request are visible to search. See
113130
<<docs-refresh>>.
114131

132+
115133
[float]
116134
[[delete-timeout]]
117-
===== Timeout
135+
==== Timeout
118136

119137
The primary shard assigned to perform the delete operation might not be
120138
available when the delete operation is executed. Some reasons for this
@@ -131,68 +149,3 @@ DELETE /twitter/_doc/1?timeout=5m
131149
--------------------------------------------------
132150
// CONSOLE
133151
// TEST[setup:twitter]
134-
135-
[[docs-delete-api-path-params]]
136-
==== {api-path-parms-title}
137-
138-
`<index>`::
139-
(Required, string) Name of the target index.
140-
141-
`<_id>`::
142-
(Required, string) Unique identifier for the document.
143-
144-
[[docs-delete-api-query-params]]
145-
==== {api-query-parms-title}
146-
147-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-seq-no]
148-
149-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-primary-term]
150-
151-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-pipeline]
152-
153-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-refresh]
154-
155-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-routing]
156-
157-
include::{docdir}/rest-api/common-parms.asciidoc[tag=timeout]
158-
159-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-version]
160-
161-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-version-type]
162-
163-
include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-wait-for-active-shards]
164-
165-
[[docs-delete-api-example]]
166-
==== {api-examples-title}
167-
168-
Delete the JSON document `1` from the `twitter` index:
169-
170-
[source,js]
171-
--------------------------------------------------
172-
DELETE /twitter/_doc/1
173-
--------------------------------------------------
174-
// CONSOLE
175-
// TEST[setup:twitter]
176-
177-
The API returns the following result:
178-
179-
[source,js]
180-
--------------------------------------------------
181-
{
182-
"_shards" : {
183-
"total" : 2,
184-
"failed" : 0,
185-
"successful" : 2
186-
},
187-
"_index" : "twitter",
188-
"_type" : "_doc",
189-
"_id" : "1",
190-
"_version" : 2,
191-
"_primary_term": 1,
192-
"_seq_no": 5,
193-
"result": "deleted"
194-
}
195-
--------------------------------------------------
196-
// TESTRESPONSE[s/"successful" : 2/"successful" : 1/]
197-
// TESTRESPONSE[s/"_primary_term" : 1/"_primary_term" : $body._primary_term/]
198-
// TESTRESPONSE[s/"_seq_no" : 5/"_seq_no" : $body._seq_no/]

docs/reference/rest-api/common-parms.asciidoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,10 @@ end::doc-wait-for-active-shards[]
165165

166166
tag::timeoutparms[]
167167

168-
tag::timeout[]
169168
`timeout`::
170169
(Optional, <<time-units, time units>>) Specifies the period of time to wait for
171170
a response. If no response is received before the timeout expires, the request
172171
fails and returns an error. Defaults to `30s`.
173-
end::timeout[]
174172

175173
tag::master-timeout[]
176174
`master_timeout`::

0 commit comments

Comments
 (0)