Skip to content

Commit 09eb09f

Browse files
committed
added documentation for the findByIds method
1 parent a7793cf commit 09eb09f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Resources/doc/find_functions.md

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ $content = $repo->find(1); // 5 is the document _uid in the elasticsearch.
1919

2020
> All `find` methods return an object. If you want to get raw result use `execute($search, Result::RESULTS_RAW)`.
2121
22+
## Find multiple documents by ID
23+
24+
If multiple documents need to be found by their IDs, `findByIds()` method can be used. It accepts an array of document IDs
25+
and returns `DocumentIterator` with found documents:
26+
27+
```php
28+
29+
$documents = $repo->findByIds(['26', '8', '11']);
30+
31+
```
32+
33+
For this functionality the `Repository` uses
34+
[elasticsearch multi get API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html).
35+
2236
## Find by field
2337

2438
Find by field uses [query_string query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) to fetch results by a specified field value.

0 commit comments

Comments
 (0)