Skip to content

Commit 8c6aab9

Browse files
authored
Merge pull request #999 from szabosteve/7.x.review.over
[DOCS] Fine-tunes overview and quick start in PHP client book
2 parents 6d2b497 + 883ed77 commit 8c6aab9

File tree

2 files changed

+59
-31
lines changed

2 files changed

+59
-31
lines changed

docs/overview.asciidoc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
[[overview]]
22
== Overview
33

4-
This is the official PHP client for Elasticsearch. It is designed to be a very low-level client that does not stray from the REST API.
5-
6-
All methods closely match the REST API, and furthermore, match the method structure of other language clients (ruby, python, etc). We hope that this consistency makes it easy to get started with a client, and to seamlessly switch from one language to the next with minimal effort.
7-
8-
The client is designed to be "unopinionated". There are a few universal niceties added to the client (cluster state sniffing, round-robin requests, etc) but largely it is very barebones. This was intentional. We want a common base that more sophisticated libraries can build on top of.
9-
4+
This is the official PHP client for {es}. It is designed to be a low-level
5+
client that does not stray from the REST API.
6+
7+
All methods closely match the REST API, and furthermore, match the method
8+
structure of other language clients (Ruby, Python, etc). We hope that this
9+
consistency makes it easy to get started with a client and to seamlessly switch
10+
from one language to the next with minimal effort.
11+
12+
The client is designed to be "unopinionated". There are a few universal niceties
13+
added to the client (cluster state sniffing, round-robin requests, and so on)
14+
but largely it is very barebones. This was intentional; we want a common base
15+
that more sophisticated libraries can build on top of.

docs/quickstart.asciidoc

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[[quickstart]]
22
== Quickstart
33

4-
This section will give you a quick overview of the client and how the major functions work.
4+
This section gives you a quick overview of the client and how the major
5+
functions work.
6+
57

68
=== Installation
79

@@ -24,7 +26,8 @@ curl -s http://getcomposer.org/installer | php
2426
php composer.phar install --no-dev
2527
----------------------------
2628

27-
* Include the autoloader in your main project (if you haven't already), and instantiate a new client :
29+
* Include the autoloader in your main project (if you haven't already), and
30+
instantiate a new client :
2831
+
2932
[source,php]
3033
----------------------------
@@ -38,11 +41,14 @@ $client = ClientBuilder::create()->build();
3841

3942
=== Index a document
4043

41-
In elasticsearch-php, almost everything is configured by associative arrays. The REST endpoint, document and optional parameters - everything is an associative array.
44+
In elasticsearch-php, almost everything is configured by associative arrays. The
45+
REST endpoint, document and optional parameters - everything is an associative
46+
array.
4247

43-
To index a document, we need to specify three pieces of information: index, id and a document body. This is done by
44-
constructing an associative array of key:value pairs. The request body is itself an associative array with key:value pairs
45-
corresponding to the data in your document:
48+
To index a document, we need to specify three pieces of information: index, id
49+
and a document body. This is done by constructing an associative array of
50+
key:value pairs. The request body is itself an associative array with key:value
51+
pairs corresponding to the data in your document:
4652

4753
[source,php]
4854
----------------------------
@@ -56,8 +62,9 @@ $response = $client->index($params);
5662
print_r($response);
5763
----------------------------
5864

59-
The response that you get back indicates the document was created in the index that you specified. The response is an
60-
associative array containing a decoded version of the JSON that Elasticsearch returns:
65+
The response that you get back indicates that the document was created in the
66+
index that you specified. The response is an associative array containing a
67+
decoded version of the JSON that {es} returns:
6168

6269
[source,php]
6370
----------------------------
@@ -72,9 +79,10 @@ Array
7279
7380
----------------------------
7481

82+
7583
=== Get a document
7684

77-
Let's get the document that we just indexed. This will simply return the document:
85+
Let's get the document that we just indexed. This returns the document:
7886

7987
[source,php]
8088
----------------------------
@@ -87,8 +95,9 @@ $response = $client->get($params);
8795
print_r($response);
8896
----------------------------
8997

90-
The response contains some metadata (index, version, etc.) as well as a `_source` field, which is the original document
91-
that you sent to Elasticsearch.
98+
99+
The response contains metadata such as index, version, and so on as well as a
100+
`_source` field, which is the original document you sent to {es}.
92101

93102
[source,php]
94103
----------------------------
@@ -107,9 +116,11 @@ Array
107116
)
108117
----------------------------
109118

119+
110120
=== Search for a document
111121

112-
Searching is a hallmark of elasticsearch, so let's perform a search. We are going to use the Match query as a demonstration:
122+
Searching is a hallmark of {es}, so let's perform a search. We are going to use
123+
the `match` query as a demonstration:
113124

114125
[source,php]
115126
----------------------------
@@ -128,8 +139,9 @@ $response = $client->search($params);
128139
print_r($response);
129140
----------------------------
130141

131-
The response is a little different from the previous responses. We see some metadata (`took`, `timed_out`, etc) and
132-
an array named `hits`. This represents your search results. Inside of `hits` is another array named `hits`, which contains
142+
The response here is different from the previous ones. You can see metadata
143+
(`took`, `timed_out`, etc.) and an array named `hits`. This represents your
144+
search results. Inside of `hits` is another array named `hits`, which contains
133145
individual search results:
134146

135147
[source,php]
@@ -167,6 +179,7 @@ Array
167179
)
168180
----------------------------
169181

182+
170183
=== Delete a document
171184

172185
Alright, let's go ahead and delete the document that we added previously:
@@ -182,8 +195,9 @@ $response = $client->delete($params);
182195
print_r($response);
183196
----------------------------
184197

185-
You'll notice this is identical syntax to the `get` syntax. The only difference is the operation: `delete` instead of
186-
`get`. The response will confirm the document was deleted:
198+
This syntax is identical to the `get` syntax. The only difference is the
199+
operation: `delete` instead of `get`. The response confirms the document is
200+
deleted:
187201

188202
[source,php]
189203
----------------------------
@@ -200,7 +214,9 @@ Array
200214

201215
=== Delete an index
202216

203-
Due to the dynamic nature of elasticsearch, the first document we added automatically built an index with some default settings. Let's delete that index because we want to specify our own settings later:
217+
Due to the dynamic nature of {es}, the first document you added automatically
218+
built an index with some default settings. Delete that index and specify your
219+
own settings later:
204220

205221
[source,php]
206222
----------------------------
@@ -224,7 +240,8 @@ Array
224240

225241
=== Create an index
226242

227-
Now that we are starting fresh (no data or index), let's add a new index with some custom settings:
243+
Now that you are starting fresh (no data or index), add a new index with custom
244+
settings:
228245

229246
[source,php]
230247
----------------------------
@@ -242,7 +259,8 @@ $response = $client->indices()->create($params);
242259
print_r($response);
243260
----------------------------
244261

245-
Elasticsearch will now create that index with your chosen settings, and return an acknowledgement:
262+
{es} now creates that index with your chosen settings and return an
263+
acknowledgement:
246264

247265
[source,php]
248266
----------------------------
@@ -252,13 +270,17 @@ Array
252270
)
253271
----------------------------
254272

273+
255274
=== Wrap up
256275

257-
That was just a crash-course overview of the client and it's syntax. If you are familiar with elasticsearch, you'll
258-
notice that the methods are named just like REST endpoints.
276+
That was just a crash-course overview of the client and it's syntax. If you are
277+
familiar with {es}, you'll notice that the methods are named just like REST
278+
endpoints.
259279

260-
You'll also notice that the client is configured in a manner that facilitates easy discovery via your IDE. All core
261-
actions are available under the `$client` object (indexing, searching, getting, etc). Index and cluster management
262-
are located under the `$client->indices()` and `$client->cluster()` objects, respectively.
280+
You may also notice that the client is configured in a manner that facilitates
281+
easy discovery via your IDE. All core actions are available under the `$client`
282+
object (indexing, searching, getting, etc). Index and cluster management are
283+
located under the `$client->indices()` and `$client->cluster()` objects,
284+
respectively.
263285

264-
Check out the rest of the Documentation to see how the entire client works.
286+
Check out the rest of the documentation to see how the entire client works.

0 commit comments

Comments
 (0)