Skip to content

Commit

Permalink
Add folder structure for helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
marciw committed May 22, 2024
1 parent 9f4b59b commit b0abb7b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/esql.asciidoc → docs/helpers/esql.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[esql]]
== ES|QL in the PHP client
=== ES|QL in the PHP client
++++
<titleabbrev>Using ES|QL</titleabbrev>
<titleabbrev>ES|QL</titleabbrev>
++++

This page helps you understand and use {ref}/esql.html[ES|QL] in the
Expand Down
10 changes: 10 additions & 0 deletions docs/helpers/index.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[client-helpers]]
== Client helpers

The PHP client comes with the following helpers:

* <<iterators>>
* <<esql>>

include::iterators.asciidoc[]
include::esql.asciidoc[]
20 changes: 6 additions & 14 deletions docs/helpers.asciidoc → docs/helpers/iterators.asciidoc
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
[[client-helpers]]
== Client helpers

The client comes with helpers to give you a more comfortable experience with
some APIs.


[discrete]
[[iterators]]
=== Iterators

The PHP client includes helpers for iterating through results by page or by hits.

[discrete]
[[search-response-iterator]]
==== Search response iterator

The `SearchResponseIterator` can be used to iterate page by page in a search
Use the `SearchResponseIterator` to iterate page by page in a search
result using
https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#paginate-search-results[pagination].

An example as follows:
Here's an example:

[source,php]
----
Expand Down Expand Up @@ -50,11 +42,11 @@ foreach($pages as $page) {
[[search-hit-iterator]]
==== Search hit iterator

The `SearchHitIterator` can be used to iterate in a `SearchResponseIterator`
Use the `SearchHitIterator` to iterate in a `SearchResponseIterator`
without worrying about
https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#paginate-search-results[pagination].

An example as follows:
Here's an example:

[source,php]
----
Expand All @@ -81,4 +73,4 @@ foreach($hits as $hit) {
// e.g. prints the document id
echo $hit['_id'], PHP_EOL;
}
----
----
4 changes: 1 addition & 3 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ include::configuration.asciidoc[]

include::operations.asciidoc[]

include::helpers.asciidoc[]

include::esql.asciidoc[]
include::helpers/index.asciidoc[]

include::release-notes.asciidoc[]

Expand Down

0 comments on commit b0abb7b

Please sign in to comment.