Skip to content

Commit

Permalink
Minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
marciw committed May 29, 2024
1 parent afd6f98 commit adfac62
Show file tree
Hide file tree
Showing 76 changed files with 14,935 additions and 15 deletions.
30 changes: 15 additions & 15 deletions docs/helpers/esql.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ There are two ways to use ES|QL in the PHP client:
is the most flexible approach, but it's also the most complex because you must handle
results in their raw form. You can choose the precise format of results,
such as JSON, CSV, or text.
* Use ES|QL `mapTo($class)` helper. This mapper take care of parsing the raw
* Use ES|QL `mapTo($class)` helper. This mapper takes care of parsing the raw
response and converting into an array of objects. If you don't specify the class
using the `$class` parameter the mapping will use the https://www.php.net/manual/en/class.stdclass.php[stdClass]
of PHP.
using the `$class` parameter, the mapper uses https://www.php.net/manual/en/class.stdclass.php[stdClass].

[discrete]
[[esql-how-to]]
Expand All @@ -28,10 +27,11 @@ results should be returned. You can choose a
JSON, then fine-tune it with parameters like column separators
and locale.

The default response from Elasticsearch is a table in JSON specified using `columns`
as array of descriptions and `values` as array of rows with the values.
The default response from Elasticsearch is a table in JSON, where `columns`
is an array of descriptions and `values` is an array of rows containing the values.

An example is as follows:
[[query-script]]
Here's an example query and PHP script:

```php
$query = <<<EOD
Expand All @@ -54,7 +54,7 @@ foreach ($result['values'] as $value) {
}
```

Given the following JSON response from Elasticsearch:
Here's the JSON response from Elasticsearch:

```json
{
Expand Down Expand Up @@ -96,7 +96,7 @@ Given the following JSON response from Elasticsearch:
}
```

The output of the revious PHP script is as follows:
Using this response, the PHP script (provided <<query-script,above>>) produces the following output:

```php
author : Stephen King
Expand Down Expand Up @@ -133,9 +133,9 @@ $result = $client->esql()->query([
var_dump($result->asArray());
```

The response will look something as follows:
The response looks something like this:

```
```json
array(12) {
[0]=>
array(6) {
Expand Down Expand Up @@ -168,7 +168,7 @@ array(12) {
string(4) "2002"
}
```
where the first row is the column descriptions and the other rows contain
In the response, the first row contains the column descriptions and the other rows contain
the values, using a plain PHP array.


Expand All @@ -179,8 +179,8 @@ the values, using a plain PHP array.
Although the `esql()->query()` API covers many use cases, your application
might require a custom mapping.

You can map the ES|QL result into an array of object, using the `mapTo()`
function, as follows:
You can map the ES|QL result into an array of objects, using the `mapTo()`
function. Here's an example:

```php
$result = $client->esql()->query([
Expand All @@ -199,10 +199,10 @@ foreach ($books as $book) {
}
```

You can also specify the class name to be used for the mapping.
You can also specify a class name for the mapping.
All the values will be assigned to the properties of the class.

Here's an example mapper that returns an array of `Book` objects.
Here's an example mapper that returns an array of `Book` objects:

```php
class Book
Expand Down
191 changes: 191 additions & 0 deletions html_docs/ElasticsearchPHP_Endpoints.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<!DOCTYPE html>
<html lang="en-us">
<head>

<meta charset="UTF-8">
<title>Reference – Endpoints | Elasticsearch-PHP | Elastic</title>
<meta class="elastic" name="content" content="Reference – Endpoints | Elasticsearch-PHP">

<link rel="home" href="index.html" title="Elasticsearch-PHP"/>
<link rel="up" href="index.html" title="Elasticsearch-PHP"/>
<link rel="prev" href="quickstart.html" title="Quickstart"/>
<meta class="elastic" name="product_version" content=""/>
<meta class="elastic" name="product_name" content=""/>
<meta class="elastic" name="website_area" content="documentation"/>
<meta name="DC.type" content="Learn/Docs/"/>
<meta name="DC.subject" content=""/>
<meta name="DC.identifier" content=""/>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.optimizely.com/js/18132920325.js"></script>
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/manifest.json">
<meta name="apple-mobile-web-app-title" content="Elastic">
<meta name="application-name" content="Elastic">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
<meta name="theme-color" content="#ffffff">
<meta name="naver-site-verification" content="936882c1853b701b3cef3721758d80535413dbfd" />
<meta name="yandex-verification" content="d8a47e95d0972434" />
<meta name="localized" content="true" />
<meta name="st:robots" content="follow,index" />
<meta property="og:image" content="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt280217a63b82a734/6202d3378b1f312528798412/elastic-logo.svg" />
<meta property="og:image:width" content="500" />
<meta property="og:image:height" content="172" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" sizes="64x64" href="/favicon_64x64_16bit.png">
<link rel="apple-touch-icon-precomposed" sizes="32x32" href="/favicon_32x32.png">
<link rel="apple-touch-icon-precomposed" sizes="16x16" href="/favicon_16x16.png">
<!-- Give IE8 a fighting chance -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/guide/static/styles.css" />
</head>

<!--© 2015-2022 Elasticsearch B.V. -->
<!-- All Elastic documentation is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. -->
<!-- http://creativecommons.org/licenses/by-nc-nd/4.0/ -->

<body>
<!-- Google Tag Manager -->
<script>dataLayer = [];</script><noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-58RLH5" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-58RLH5');</script>
<!-- End Google Tag Manager -->

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-12395217-16"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-12395217-16');
</script>

<!-- Google Tag Manager for GA4 -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KNJMG2M');</script>
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KNJMG2M" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager for GA4-->

<div id='elastic-nav' style="display:none;"></div>
<script src='https://www.elastic.co/elastic-nav.js'></script>

<div class="main-container">
<section id="content" >
<div class="content-wrapper">

<section id="guide" lang="en">
<div class="container-fluid">
<div class="row pb-3">
<div class="col-12 order-2 col-md-4 order-md-1 col-lg-3 h-almost-full-md sticky-top-md" id="left_col">
<!-- The TOC is appended here -->
</div>

<div class="col-12 order-1 col-md-8 order-md-2 col-lg-7 order-lg-2 guide-section" id="middle_col">
<!-- start body -->

<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="/guide/">Elastic Docs</a></span>
<span class="chevron-right"></span><span class="breadcrumb-link"><a href="index.html">Elasticsearch-PHP</a></span>
</div>
<div class="navheader">
<span class="prev">
<a href="quickstart.html">« Quickstart</a>
</span>
<span class="next">
</span>
</div>
<div class="chapter exclude">
<div class="titlepage"><div><div>
<h1 class="title"><a id="ElasticsearchPHP_Endpoints"></a>Reference – Endpoints<a class="edit_me" rel="nofollow" title="Edit this page on GitHub" href="https://github.com/elastic/elasticsearch-php/edit/master/docs/redirects.asciidoc">edit</a></h1>
</div></div></div>
<p>This page has been removed.</p>
</div>
<div class="navfooter">
<span class="prev">
<a href="quickstart.html">« Quickstart</a>
</span>
<span class="next">
</span>
</div>
</div>

<!-- end body -->
</div>

<div class="col-12 order-3 col-lg-2 order-lg-3 h-almost-full-lg sticky-top-lg" id="right_col">
<div id="sticky_content">
<!-- The OTP is appended here -->
<div class="row">
<div class="col-0 col-md-4 col-lg-0" id="bottom_left_col"></div>
<div class="col-12 col-md-8 col-lg-12">
<div id="rtpcontainer">
<div class="mktg-promo" id="most-popular">
<p class="aside-heading">Most Popular</p>
<div class="pb-2">
<p class="media-type">Video</p>
<a href="https://www.elastic.co/webinars/getting-started-elasticsearch?page=docs&placement=top-video">
<p class="mb-0">Get Started with Elasticsearch</p>
</a>
</div>
<div class="pb-2">
<p class="media-type">Video</p>
<a href="https://www.elastic.co/webinars/getting-started-kibana?page=docs&placement=top-video">
<p class="mb-0">Intro to Kibana</p>
</a>
</div>
<div class="pb-2">
<p class="media-type">Video</p>
<a href="https://www.elastic.co/webinars/introduction-elk-stack?page=docs&placement=top-video">
<p class="mb-0">ELK for Logs & Metrics</p>
</a>
</div>
</div>
</div>

<!-- Feedback widget -->
<div id="feedbackWidgetContainer"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

</div>


<div id='elastic-footer'></div>
<script src='https://www.elastic.co/elastic-footer.js'></script>
<!-- Footer Section end-->

</section>
</div>

<!-- Feedback modal -->
<div id="feedbackModalContainer"></div>

<script src="/guide/static/jquery.js"></script>
<script type="text/javascript" src="/guide/static/docs.js"></script>
<script type="text/javascript">
window.initial_state = {}</script>
</body>
</html>
Loading

0 comments on commit adfac62

Please sign in to comment.