|
| 1 | +# Licensed to Elasticsearch B.V. under one or more contributor |
| 2 | +# license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright |
| 4 | +# ownership. Elasticsearch B.V. licenses this file to you under |
| 5 | +# the Apache License, Version 2.0 (the "License"); you may |
| 6 | +# not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | +# |
| 18 | +# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80 |
| 19 | +# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec |
| 20 | +# |
| 21 | +module Elasticsearch |
| 22 | + module API |
| 23 | + module TextStructure |
| 24 | + module Actions |
| 25 | + # Finds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch. |
| 26 | + # |
| 27 | + # @option arguments [Time] :timeout Timeout after which the analysis will be aborted |
| 28 | + # @option arguments [String] :format Optional parameter to specify the high level file format (options: ndjson, xml, delimited, semi_structured_text) |
| 29 | + # @option arguments [List] :column_names Optional parameter containing a comma separated list of the column names for a delimited file |
| 30 | + # @option arguments [String] :delimiter Optional parameter to specify the delimiter character for a delimited file - must be a single character |
| 31 | + # @option arguments [String] :quote Optional parameter to specify the quote character for a delimited file - must be a single character |
| 32 | + # @option arguments [Boolean] :should_trim_fields Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them |
| 33 | + # @option arguments [String] :grok_pattern Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file |
| 34 | + # @option arguments [String] :ecs_compatibility Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled' |
| 35 | + # @option arguments [String] :timestamp_field Optional parameter to specify the timestamp field in the file |
| 36 | + # @option arguments [String] :timestamp_format Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format |
| 37 | + # @option arguments [Boolean] :explain Whether to include a commentary on how the structure was derived |
| 38 | + # @option arguments [Hash] :headers Custom HTTP headers |
| 39 | + # @option arguments [Hash] :body JSON object with one field [messages], containing an array of messages to be analyzed (*Required*) |
| 40 | + # |
| 41 | + # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-message-structure.html |
| 42 | + # |
| 43 | + def find_message_structure(arguments = {}) |
| 44 | + request_opts = { endpoint: arguments[:endpoint] || 'text_structure.find_message_structure' } |
| 45 | + |
| 46 | + raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] |
| 47 | + |
| 48 | + arguments = arguments.clone |
| 49 | + headers = arguments.delete(:headers) || {} |
| 50 | + |
| 51 | + body = arguments.delete(:body) |
| 52 | + |
| 53 | + method = Elasticsearch::API::HTTP_POST |
| 54 | + path = '_text_structure/find_message_structure' |
| 55 | + params = Utils.process_params(arguments) |
| 56 | + |
| 57 | + Elasticsearch::API::Response.new( |
| 58 | + perform_request(method, path, params, body, headers, request_opts) |
| 59 | + ) |
| 60 | + end |
| 61 | + end |
| 62 | + end |
| 63 | + end |
| 64 | +end |
0 commit comments