1<?php
2/**
3 * Elasticsearch PHP client
4 *
5 * @link      https://github.com/elastic/elasticsearch-php/
6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
7 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
8 * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
9 *
10 * Licensed to Elasticsearch B.V under one or more agreements.
11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
12 * the GNU Lesser General Public License, Version 2.1, at your option.
13 * See the LICENSE file in the project root for more information.
14 */
15declare(strict_types = 1);
16
17namespace Elasticsearch\Namespaces;
18
19use Elasticsearch\Namespaces\AbstractNamespace;
20
21/**
22 * Class EqlNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class EqlNamespace extends AbstractNamespace
28{
29
30    /**
31     * Deletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted.
32     *
33     * $params['id'] = (string) The async search ID
34     *
35     * @param array $params Associative array of parameters
36     * @return array
37     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
38     */
39    public function delete(array $params = [])
40    {
41        $id = $this->extractArgument($params, 'id');
42
43        $endpointBuilder = $this->endpoints;
44        $endpoint = $endpointBuilder('Eql\Delete');
45        $endpoint->setParams($params);
46        $endpoint->setId($id);
47
48        return $this->performRequest($endpoint);
49    }
50    /**
51     * Returns async results from previously executed Event Query Language (EQL) search
52     *
53     * $params['id']                          = (string) The async search ID
54     * $params['wait_for_completion_timeout'] = (time) Specify the time that the request should block waiting for the final response
55     * $params['keep_alive']                  = (time) Update the time interval in which the results (partial or final) for this search will be available (Default = 5d)
56     *
57     * @param array $params Associative array of parameters
58     * @return array
59     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
60     */
61    public function get(array $params = [])
62    {
63        $id = $this->extractArgument($params, 'id');
64
65        $endpointBuilder = $this->endpoints;
66        $endpoint = $endpointBuilder('Eql\Get');
67        $endpoint->setParams($params);
68        $endpoint->setId($id);
69
70        return $this->performRequest($endpoint);
71    }
72    /**
73     * Returns the status of a previously submitted async or stored Event Query Language (EQL) search
74     *
75     * $params['id'] = (string) The async search ID
76     *
77     * @param array $params Associative array of parameters
78     * @return array
79     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
80     */
81    public function getStatus(array $params = [])
82    {
83        $id = $this->extractArgument($params, 'id');
84
85        $endpointBuilder = $this->endpoints;
86        $endpoint = $endpointBuilder('Eql\GetStatus');
87        $endpoint->setParams($params);
88        $endpoint->setId($id);
89
90        return $this->performRequest($endpoint);
91    }
92    /**
93     * Returns results matching a query expressed in Event Query Language (EQL)
94     *
95     * $params['index']                       = (string) The name of the index to scope the operation
96     * $params['wait_for_completion_timeout'] = (time) Specify the time that the request should block waiting for the final response
97     * $params['keep_on_completion']          = (boolean) Control whether the response should be stored in the cluster if it completed within the provided [wait_for_completion] time (default: false) (Default = false)
98     * $params['keep_alive']                  = (time) Update the time interval in which the results (partial or final) for this search will be available (Default = 5d)
99     * $params['body']                        = (array) Eql request body. Use the `query` to limit the query scope. (Required)
100     *
101     * @param array $params Associative array of parameters
102     * @return array
103     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
104     */
105    public function search(array $params = [])
106    {
107        $index = $this->extractArgument($params, 'index');
108        $body = $this->extractArgument($params, 'body');
109
110        $endpointBuilder = $this->endpoints;
111        $endpoint = $endpointBuilder('Eql\Search');
112        $endpoint->setParams($params);
113        $endpoint->setIndex($index);
114        $endpoint->setBody($body);
115
116        return $this->performRequest($endpoint);
117    }
118}
119