You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/crud.asciidoc
+47-27Lines changed: 47 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,21 @@
1
1
[[indexing_documents]]
2
-
== Indexing Documents
2
+
== Indexing documents
3
3
4
-
IMPORTANT: Please note that mapping types will disappear from Elasticsearch, read more https://www.elastic.co/guide/en/elasticsearch/reference/7.x/removal-of-types.html[here]. If you migrated types from Elasticsearch 6 to 7, you can address these with the `type` param.
4
+
IMPORTANT: Please note that mapping types will disappear from {es}, read more
5
+
{ref-7x}/removal-of-types.html[here]. If you migrated types from {es} 6 to 7,
6
+
you can address these with the `type` param.
7
+
8
+
When you add documents to {es}, you index JSON documents. This maps naturally to
9
+
PHP associative arrays, since they can easily be encoded in JSON. Therefore, in
10
+
Elasticsearch-PHP you create and pass associative arrays to the client for
11
+
indexing. There are several methods of ingesting data into {es} which we cover
12
+
here.
5
13
6
-
When you add documents to Elasticsearch, you index JSON documents. This maps naturally to PHP associative arrays, since
7
-
they can easily be encoded in JSON. Therefore, in Elasticsearch-PHP you create and pass associative arrays to the client
8
-
for indexing. There are several methods of ingesting data into Elasticsearch, which we will cover here.
9
14
10
15
=== Single document indexing
11
16
12
-
When indexing a document, you can either provide an ID or let elasticsearch generate one for you.
17
+
When indexing a document, you can either provide an ID or let {es} generate one
If you need to set other parameters, such as a `routing` value, you specify those in the array alongside the `index`, etc. For example, let's set the routing and timestamp of this new document:
49
+
If you need to set other parameters, such as a `routing` value, you specify
50
+
those in the array alongside the `index`, and others. For example, let's set the
The Scrolling functionality of Elasticsearch is used to paginate over many documents in a bulk manner, such as exporting
220
-
all the documents belonging to a single user. It is more efficient than regular search because it doesn't need to maintain
221
-
an expensive priority queue ordering the documents.
238
+
The scrolling functionality of {es} is used to paginate over many documents in a
239
+
bulk manner, such as exporting all the documents belonging to a single user. It
240
+
is more efficient than regular search because it doesn't need to maintain an
241
+
expensive priority queue ordering the documents.
222
242
223
-
Scrolling works by maintaining a "point in time" snapshot of the index which is then used to page over.
224
-
This window allows consistent paging even if there is background indexing/updating/deleting. First, you execute a search
225
-
request with `scroll` enabled. This returns a "page" of documents, and a scroll_id which is used to continue
226
-
paginating through the hits.
243
+
Scrolling works by maintaining a "point in time" snapshot of the index which is
244
+
then used to page over. This window allows consistent paging even if there is
245
+
background indexing/updating/deleting. First, you execute a search request with
246
+
`scroll` enabled. This returns a "page" of documents, and a `scroll_id` which is
247
+
used to continue paginating through the hits.
227
248
228
-
More details about scrolling can be found in the https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-scroll[Link: reference documentation].
0 commit comments