Skip to content

Commit 0d5a514

Browse files
authored
[DOCS] Adds Operations section to PHP book (#1110)
* [DOCS] Adds Operations section to PHP book. * [DOCS] Fixes docs build.
1 parent 2636824 commit 0d5a514

File tree

5 files changed

+43
-28
lines changed

5 files changed

+43
-28
lines changed

docs/crud.asciidoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[indexing_documents]]
2-
== Indexing documents
2+
=== Indexing documents
33

44
IMPORTANT: Please note that mapping types will disappear from {es}, read more
55
{ref-7x}/removal-of-types.html[here]. If you migrated types from {es} 6 to 7,
@@ -12,7 +12,7 @@ indexing. There are several methods of ingesting data into {es} which we cover
1212
here.
1313

1414
[discrete]
15-
=== Single document indexing
15+
==== Single document indexing
1616

1717
When indexing a document, you can either provide an ID or let {es} generate one
1818
for you.
@@ -67,7 +67,7 @@ $response = $client->index($params);
6767
{zwsp} +
6868

6969
[discrete]
70-
=== Bulk Indexing
70+
==== Bulk Indexing
7171

7272
{es} also supports bulk indexing of documents. The bulk API expects JSON
7373
action/metadata pairs, separated by newlines. When constructing your documents
@@ -137,7 +137,7 @@ if (!empty($params['body'])) {
137137
----
138138

139139
[[getting_documents]]
140-
== Getting documents
140+
=== Getting documents
141141

142142
{es} provides realtime GETs of documents. This means that as soon as the
143143
document is indexed and your client receives an acknowledgement, you can
@@ -157,14 +157,14 @@ $response = $client->get($params);
157157
{zwsp} +
158158

159159
[[updating_documents]]
160-
== Updating documents
160+
=== Updating documents
161161

162162
Updating a document allows you to either completely replace the contents of the
163163
existing document, or perform a partial update to just some fields (either
164164
changing an existing field or adding new fields).
165165

166166
[discrete]
167-
=== Partial document update
167+
==== Partial document update
168168

169169
If you want to partially update a document (for example, change an existing
170170
field or add a new one) you can do so by specifying the `doc` in the `body`
@@ -189,7 +189,7 @@ $response = $client->update($params);
189189
{zwsp} +
190190

191191
[discrete]
192-
=== Scripted document update
192+
==== Scripted document update
193193

194194
Sometimes you need to perform a scripted update, such as incrementing a counter
195195
or appending a new value to an array. To perform a scripted update, you need to
@@ -213,7 +213,7 @@ $response = $client->update($params);
213213
{zwsp} +
214214

215215
[discrete]
216-
=== Upserts
216+
==== Upserts
217217

218218
Upserts are "Update or Insert" operations. This means an upsert attempts to run
219219
your update script, but if the document does not exist (or the field you are
@@ -243,7 +243,7 @@ $response = $client->update($params);
243243

244244

245245
[[deleting_documents]]
246-
== Deleting documents
246+
=== Deleting documents
247247

248248
Finally, you can delete documents by specifying their full `/index/_doc_/id`
249249
path:

docs/index-operations.asciidoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[[index_management]]
2-
== Index management operations
2+
=== Index management operations
33

44
Index management operations allow you to manage the indices in your {es}
55
cluster, such as creating, deleting and updating indices and their
66
mappings/settings.
77

88
[discrete]
9-
=== Create an index
9+
==== Create an index
1010

1111
The index operations are all contained under a distinct namespace, separated
1212
from other methods that are on the root client object. As an example, let's
@@ -61,7 +61,7 @@ $response = $client->indices()->create($params);
6161
{zwsp} +
6262

6363
[discrete]
64-
=== Create an index (advanced example)
64+
==== Create an index (advanced example)
6565

6666
This is a more complicated example of creating an index, showing how to define
6767
analyzers, tokenizers, filters and index settings. Although essentially the same
@@ -139,7 +139,7 @@ char filters and analyzers.
139139
mappings for various types.
140140

141141
[discrete]
142-
=== Delete an index
142+
==== Delete an index
143143

144144
Deleting an index is very simple:
145145

@@ -172,7 +172,7 @@ $response = $client->indices()->putSettings($params);
172172
{zwsp} +
173173

174174
[discrete]
175-
=== GET Settings API
175+
==== GET Settings API
176176

177177
The GET Settings API shows you the currently configured settings for one or more
178178
indices:
@@ -192,7 +192,7 @@ $response = $client->indices()->getSettings($params);
192192
{zwsp} +
193193

194194
[discrete]
195-
=== PUT Mappings API
195+
==== PUT Mappings API
196196

197197
The PUT Mappings API allows you to modify or add to an existing index's mapping.
198198

@@ -223,7 +223,7 @@ $client->indices()->putMapping($params);
223223
{zwsp} +
224224

225225
[discrete]
226-
=== GET Mappings API
226+
==== GET Mappings API
227227

228228
The GET Mappings API returns the mapping details about your indices. Depending
229229
on the mappings that you wish to retrieve, you can specify one of more indices:
@@ -246,7 +246,7 @@ $response = $client->indices()->getMapping($params);
246246
{zwsp} +
247247

248248
[discrete]
249-
=== Other APIs in the indices namespace
249+
==== Other APIs in the indices namespace
250250

251251
There are a number of other APIs in the indices namespace that allow you to
252252
manage your {es} indices (add/remove templates, flush segments, close indices,

docs/index.asciidoc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ include::connecting.asciidoc[]
1111

1212
include::configuration.asciidoc[]
1313

14-
include::php_json_objects.asciidoc[]
15-
16-
include::index-operations.asciidoc[]
14+
include::operations.asciidoc[]
1715

18-
include::crud.asciidoc[]
19-
20-
include::search-operations.asciidoc[]
16+
include::php_json_objects.asciidoc[]
2117

2218
include::breaking-changes.asciidoc[]
2319

docs/operations.asciidoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[[operations]]
2+
== Operations
3+
4+
This page contains the information you need to perform various {es} operations
5+
by using the Client.
6+
7+
* <<index_management>>
8+
* <<search_operations>>
9+
* <<indexing_documents>>
10+
* <<getting_documents>>
11+
* <<updating_documents>>
12+
* <<deleting_documents>>
13+
14+
include::index-operations.asciidoc[]
15+
16+
include::search-operations.asciidoc[]
17+
18+
include::crud.asciidoc[]

docs/search-operations.asciidoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[search_operations]]
2-
== Search operations
2+
=== Search operations
33

44
Well...it isn't called {es} for nothing! Let's talk about search operations in
55
the client.
@@ -9,7 +9,7 @@ REST API, following the naming scheme as much as possible. Let's look at a few
99
examples so you can become familiar with the syntax.
1010

1111
[discrete]
12-
=== Match query
12+
==== Match query
1313

1414
Here is a standard curl for a match query:
1515

@@ -127,7 +127,7 @@ $doc = $results['hits']['hits'][0]['_source'];
127127
{zwsp} +
128128

129129
[discrete]
130-
=== Bool Queries
130+
==== Bool Queries
131131

132132
Bool queries can be easily constructed using the client. For example, this
133133
query:
@@ -181,7 +181,7 @@ identical to the curl example. For more details about arrays and objects in PHP,
181181
see <<php_json_objects, Dealing with JSON Arrays and Objects in PHP>>.
182182

183183
[discrete]
184-
=== A more complicated example
184+
==== A more complicated example
185185

186186
Let's construct a slightly more complicated example: a boolean query that
187187
contains both a filter and a query. This is a very common activity in {es}
@@ -232,8 +232,9 @@ $results = $client->search($params);
232232
----
233233
{zwsp} +
234234

235+
235236
[discrete]
236-
=== Scrolling
237+
==== Scrolling
237238

238239
The scrolling functionality of {es} is used to paginate over many documents in a
239240
bulk manner, such as exporting all the documents belonging to a single user. It

0 commit comments

Comments
 (0)