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 TextStructureNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class TextStructureNamespace extends AbstractNamespace
28{
29
30    /**
31     * Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch.
32     *
33     * $params['lines_to_sample']       = (int) How many lines of the file should be included in the analysis (Default = 1000)
34     * $params['line_merge_size_limit'] = (int) Maximum number of characters permitted in a single message when lines are merged to create messages. (Default = 10000)
35     * $params['timeout']               = (time) Timeout after which the analysis will be aborted (Default = 25s)
36     * $params['charset']               = (string) Optional parameter to specify the character set of the file
37     * $params['format']                = (enum) Optional parameter to specify the high level file format (Options = ndjson,xml,delimited,semi_structured_text)
38     * $params['has_header_row']        = (boolean) Optional parameter to specify whether a delimited file includes the column names in its first row
39     * $params['column_names']          = (list) Optional parameter containing a comma separated list of the column names for a delimited file
40     * $params['delimiter']             = (string) Optional parameter to specify the delimiter character for a delimited file - must be a single character
41     * $params['quote']                 = (string) Optional parameter to specify the quote character for a delimited file - must be a single character
42     * $params['should_trim_fields']    = (boolean) Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them
43     * $params['grok_pattern']          = (string) Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file
44     * $params['timestamp_field']       = (string) Optional parameter to specify the timestamp field in the file
45     * $params['timestamp_format']      = (string) Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format
46     * $params['explain']               = (boolean) Whether to include a commentary on how the structure was derived (Default = false)
47     * $params['body']                  = (array) The contents of the file to be analyzed (Required)
48     *
49     * @param array $params Associative array of parameters
50     * @return array
51     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html
52     */
53    public function findStructure(array $params = [])
54    {
55        $body = $this->extractArgument($params, 'body');
56
57        $endpointBuilder = $this->endpoints;
58        $endpoint = $endpointBuilder('TextStructure\FindStructure');
59        $endpoint->setParams($params);
60        $endpoint->setBody($body);
61
62        return $this->performRequest($endpoint);
63    }
64}
65