Skip to content

Commit

Permalink
Updated endpoints to 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Aug 10, 2022
2 parents 161682c + e98c4d3 commit 7815caa
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- job:
name: elastic+elasticsearch-php+6.8.x
display-name: 'elastic / elasticsearch-php # 6.8.x'
description: Testing the elasticsearch-php 6.8.x branch.
name: elastic+elasticsearch-php+8.4
display-name: 'elastic / elasticsearch-php # 8.4'
description: Testing the elasticsearch-php 8.4 branch.
parameters:
- string:
name: branch_specifier
default: refs/heads/6.8.x
default: refs/heads/8.4
description: the Git branch specifier to build (<branchName>, <tagName>,
<commitId>, etc.)
triggers:
Expand Down
2 changes: 1 addition & 1 deletion .ci/test-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
STACK_VERSION:
- 8.4.0-SNAPSHOT
- 8.4-SNAPSHOT

PHP_VERSION:
- 8.1-cli
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
php-version: [7.4, 8.0, 8.1]
os: [ubuntu-latest]
es-version: [8.4.0-SNAPSHOT]
es-version: [8.4-SNAPSHOT]

steps:
- name: Checkout
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is the official PHP client for
- [Search a document](#search-a-document)
- [Delete a document](#delete-a-document)
- [Versioning](#versioning)
- [Backward Incompatible Changes](#backward-incompatible-changes-)
- [Backward Incompatible Changes](#backward-incompatible-changes-boom)
- [Mock the Elasticsearch client](#mock-the-elasticsearch-client)
- [FAQ](#faq-)
- [Contribute](#contribute-)
Expand Down Expand Up @@ -118,7 +118,7 @@ docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elasti
This command creates an `elastic` Docker network and start Elasticsearch
using the port `9200` (default).

When you run the docker imnage a password is generated for the `elastic` user
When you run the docker image a password is generated for the `elastic` user
and it's printed to the terminal (you might need to scroll back a bit in the
terminal to view it). You have to copy it since we will need to connect to
Elasticsearch.
Expand Down Expand Up @@ -384,7 +384,7 @@ section of PHP-HTTP documentation.
### Where do I report issues with the client?

If something is not working as expected, please open an
[issue](https://github.com/elastic/elasticsearh-php/issues/new).
[issue](https://github.com/elastic/elasticsearch-php/issues/new).

### Where else can I go to get help?

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ create this object, as follows:
--------------------------
require 'vendor/autoload.php';
$client = Elasticsearch\ClientBuilder::create()->build();
$client = Elastic\Elasticsearch\ClientBuilder::create()->build();
--------------------------
+
Client instantiation is performed with a static helper function `create()`. This
Expand Down
3 changes: 2 additions & 1 deletion src/Endpoints/Ml.php
Original file line number Diff line number Diff line change
Expand Up @@ -2340,6 +2340,7 @@ public function startDatafeed(array $params = [])
*
* @param array{
* model_id: string, // (REQUIRED) The unique identifier of the trained model.
* cache_size: string, // A byte-size value for configuring the inference cache size. For example, 20mb.
* number_of_allocations: int, // The number of model allocations on each node where the model is deployed.
* threads_per_allocation: int, // The number of threads used by each model allocation during inference.
* queue_capacity: int, // Controls how many inference requests are allowed in the queue at a time.
Expand All @@ -2365,7 +2366,7 @@ public function startTrainedModelDeployment(array $params = [])
$url = '/_ml/trained_models/' . $this->encode($params['model_id']) . '/deployment/_start';
$method = 'POST';

$url = $this->addQueryString($url, $params, ['number_of_allocations','threads_per_allocation','queue_capacity','timeout','wait_for','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['cache_size','number_of_allocations','threads_per_allocation','queue_capacity','timeout','wait_for','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand Down
37 changes: 37 additions & 0 deletions src/Endpoints/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -1908,6 +1908,43 @@ public function suggestUserProfiles(array $params = [])
}


/**
* Updates attributes of an existing API key.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-api-key.html
*
* @param array{
* id: string, // (REQUIRED) The ID of the API key to update
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path: list, // A comma-separated list of filters used to reduce the response.
* body: array, // The API key request to update attributes of an API key.
* } $params
*
* @throws MissingParameterException if a required parameter is missing
* @throws NoNodeAvailableException if all the hosts are offline
* @throws ClientResponseException if the status code of response is 4xx
* @throws ServerResponseException if the status code of response is 5xx
*
* @return Elasticsearch|Promise
*/
public function updateApiKey(array $params = [])
{
$this->checkRequiredParameters(['id'], $params);
$url = '/_security/api_key/' . $this->encode($params['id']);
$method = 'PUT';

$url = $this->addQueryString($url, $params, ['pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
return $this->client->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null));
}


/**
* Update application specific data for the user profile of the given unique ID.
*
Expand Down
9 changes: 8 additions & 1 deletion src/Endpoints/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ public function deleteRepository(array $params = [])
* index_names: boolean, // Whether to include the name of each index in the snapshot. Defaults to true.
* index_details: boolean, // Whether to include details of each index in the snapshot, if those details are available. Defaults to false.
* include_repository: boolean, // Whether to include the repository name in the snapshot info. Defaults to true.
* sort: enum, // Allows setting a sort order for the result. Defaults to start_time
* size: integer, // Maximum number of snapshots to return. Defaults to 0 which means return all that match without limit.
* order: enum, // Sort order
* from_sort_value: string, // Value of the current sort column at which to start retrieval.
* after: string, // Offset identifier to start pagination from as returned by the 'next' field in the response body.
* offset: integer, // Numeric offset to start pagination based on the snapshots matching the request. Defaults to 0
* slm_policy_filter: string, // Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Accepts wildcards. Use the special pattern '_none' to match snapshots without an SLM policy
* verbose: boolean, // Whether to show verbose snapshot info or only show the basic info found in the repository index blob
* pretty: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human: boolean, // Return human readable values for statistics. (DEFAULT: true)
Expand All @@ -293,7 +300,7 @@ public function get(array $params = [])
$url = '/_snapshot/' . $this->encode($params['repository']) . '/' . $this->encode($params['snapshot']);
$method = 'GET';

$url = $this->addQueryString($url, $params, ['master_timeout','ignore_unavailable','index_names','index_details','include_repository','verbose','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['master_timeout','ignore_unavailable','index_names','index_details','include_repository','sort','size','order','from_sort_value','after','offset','slm_policy_filter','verbose','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down
9 changes: 6 additions & 3 deletions src/Traits/ClientEndpointsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ public function fieldCaps(array $params = [])
* @param array{
* id: string, // (REQUIRED) The document ID
* index: string, // (REQUIRED) The name of the index
* force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
* stored_fields: list, // A comma-separated list of stored fields to return in the response
* preference: string, // Specify the node or shard the operation should be performed on (default: random)
* realtime: boolean, // Specify whether to perform the operation in realtime or search mode
Expand Down Expand Up @@ -659,7 +660,7 @@ public function get(array $params = [])
$url = '/' . $this->encode($params['index']) . '/_doc/' . $this->encode($params['id']);
$method = 'GET';

$url = $this->addQueryString($url, $params, ['stored_fields','preference','realtime','refresh','routing','_source','_source_excludes','_source_includes','version','version_type','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['force_synthetic_source','stored_fields','preference','realtime','refresh','routing','_source','_source_excludes','_source_includes','version','version_type','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
];
Expand Down Expand Up @@ -943,6 +944,7 @@ public function knnSearch(array $params = [])
*
* @param array{
* index: string, // The name of the index
* force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
* stored_fields: list, // A comma-separated list of stored fields to return in the response
* preference: string, // Specify the node or shard the operation should be performed on (default: random)
* realtime: boolean, // Specify whether to perform the operation in realtime or search mode
Expand Down Expand Up @@ -975,7 +977,7 @@ public function mget(array $params = [])
$url = '/_mget';
$method = empty($params['body']) ? 'GET' : 'POST';
}
$url = $this->addQueryString($url, $params, ['stored_fields','preference','realtime','refresh','routing','_source','_source_excludes','_source_includes','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['force_synthetic_source','stored_fields','preference','realtime','refresh','routing','_source','_source_excludes','_source_includes','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand Down Expand Up @@ -1499,6 +1501,7 @@ public function scroll(array $params = [])
* stored_fields: list, // A comma-separated list of stored fields to return as part of a hit
* docvalue_fields: list, // A comma-separated list of fields to return as the docvalue representation of a field for each hit
* from: number, // Starting offset (default: 0)
* force_synthetic_source: boolean, // Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
* ignore_unavailable: boolean, // Whether specified concrete indices should be ignored when unavailable (missing or closed)
* ignore_throttled: boolean, // Whether specified concrete, expanded or aliased indices should be ignored when throttled
* allow_no_indices: boolean, // Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
Expand Down Expand Up @@ -1556,7 +1559,7 @@ public function search(array $params = [])
$url = '/_search';
$method = empty($params['body']) ? 'GET' : 'POST';
}
$url = $this->addQueryString($url, $params, ['analyzer','analyze_wildcard','ccs_minimize_roundtrips','default_operator','df','explain','stored_fields','docvalue_fields','from','ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','lenient','preference','q','routing','scroll','search_type','size','sort','_source','_source_excludes','_source_includes','terminate_after','stats','suggest_field','suggest_mode','suggest_size','suggest_text','timeout','track_scores','track_total_hits','allow_partial_search_results','typed_keys','version','seq_no_primary_term','request_cache','batched_reduce_size','max_concurrent_shard_requests','pre_filter_shard_size','rest_total_hits_as_int','min_compatible_shard_node','pretty','human','error_trace','source','filter_path']);
$url = $this->addQueryString($url, $params, ['analyzer','analyze_wildcard','ccs_minimize_roundtrips','default_operator','df','explain','stored_fields','docvalue_fields','from','force_synthetic_source','ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','lenient','preference','q','routing','scroll','search_type','size','sort','_source','_source_excludes','_source_includes','terminate_after','stats','suggest_field','suggest_mode','suggest_size','suggest_text','timeout','track_scores','track_total_hits','allow_partial_search_results','typed_keys','version','seq_no_primary_term','request_cache','batched_reduce_size','max_concurrent_shard_requests','pre_filter_shard_size','rest_total_hits_as_int','min_compatible_shard_node','pretty','human','error_trace','source','filter_path']);
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
Expand Down
3 changes: 2 additions & 1 deletion util/YamlTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class YamlTests
const YAML_FILES_TO_OMIT = [
'platinum/eql/10_basic.yml',
// use of _internal APIs
'free/cluster.desired_nodes/10_basic.yml',
'free/cluster.desired_nodes/10_basic.yml',
'free/cluster.desired_nodes/20_dry_run.yml',
'free/health/'
];

Expand Down

0 comments on commit 7815caa

Please sign in to comment.