From ef9828cb9356f753d17dd3938957467db3e34da9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:18:48 -0800 Subject: [PATCH] Add find field structure and find messages structure APIs (#3346) (#3384) Co-authored-by: Florian Bernd (cherry picked from commit 4b93d7f3ad7485ebe5c71dc2908797e44f7f3354) Co-authored-by: Lisa Cawley --- output/openapi/elasticsearch-openapi.json | 574 +++++++- output/schema/schema.json | 1292 ++++++++++++++--- output/schema/validation-errors.json | 12 - output/typescript/types.ts | 90 +- specification/_doc_ids/table.csv | 2 + .../types.ts => _types/Structure.ts} | 12 + .../FindFieldStructureRequest.ts | 162 +++ .../FindFieldStructureResponse.ts | 49 + .../FindMessageStructureRequest.ts | 163 +++ .../FindMessageStructureResponse.ts | 49 + .../find_structure/FindStructureRequest.ts | 4 +- .../find_structure/FindStructureResponse.ts | 2 +- 12 files changed, 2148 insertions(+), 263 deletions(-) rename specification/text_structure/{find_structure/types.ts => _types/Structure.ts} (89%) create mode 100644 specification/text_structure/find_field_structure/FindFieldStructureRequest.ts create mode 100644 specification/text_structure/find_field_structure/FindFieldStructureResponse.ts create mode 100644 specification/text_structure/find_message_structure/FindMessageStructureRequest.ts create mode 100644 specification/text_structure/find_message_structure/FindMessageStructureResponse.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 0bc7867e12..d258428706 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -34272,6 +34272,343 @@ } } }, + "/_text_structure/find_field_structure": { + "get": { + "tags": [ + "text_structure" + ], + "summary": "Find the structure of a text field", + "description": "Find the structure of a text field in an Elasticsearch index.", + "operationId": "text-structure-find-field-structure", + "parameters": [ + { + "in": "query", + "name": "column_names", + "description": "If `format` is set to `delimited`, you can specify the column names in a comma-separated list.\nIf this parameter is not specified, the structure finder uses the column names from the header row of the text.\nIf the text does not have a header row, columns are named \"column1\", \"column2\", \"column3\", for example.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + }, + { + "in": "query", + "name": "delimiter", + "description": "If you have set `format` to `delimited`, you can specify the character used to delimit the values in each row.\nOnly a single character is supported; the delimiter cannot have multiple characters.\nBy default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`).\nIn this default scenario, all rows must have the same number of fields for the delimited format to be detected.\nIf you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + }, + { + "in": "query", + "name": "documents_to_sample", + "description": "The number of documents to include in the structural analysis.\nThe minimum value is 2.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:uint" + }, + "style": "form" + }, + { + "in": "query", + "name": "ecs_compatibility", + "description": "The mode of compatibility with ECS compliant Grok patterns.\nUse this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern.\nThis setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input.\nIf the structure finder identifies a common structure but has no idea of the meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output.\nThe intention in that situation is that a user who knows the meanings will rename the fields before using them.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/text_structure._types:EcsCompatibilityType" + }, + "style": "form" + }, + { + "in": "query", + "name": "explain", + "description": "If true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "field", + "description": "The field that should be analyzed.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Field" + }, + "style": "form" + }, + { + "in": "query", + "name": "format", + "description": "The high level structure of the text.\nBy default, the API chooses the format.\nIn this default scenario, all rows must have the same number of fields for a delimited format to be detected.\nIf the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/text_structure._types:FormatType" + }, + "style": "form" + }, + { + "in": "query", + "name": "grok_pattern", + "description": "If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text.\nThe name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter.\nIf that parameter is not specified, the name of the timestamp field in the Grok pattern must match \"timestamp\".\nIf `grok_pattern` is not specified, the structure finder creates a Grok pattern.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:GrokPattern" + }, + "style": "form" + }, + { + "in": "query", + "name": "index", + "description": "The name of the index that contains the analyzed field.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:IndexName" + }, + "style": "form" + }, + { + "in": "query", + "name": "quote", + "description": "If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character.\nOnly a single character is supported.\nIf this parameter is not specified, the default value is a double quote (`\"`).\nIf your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + }, + { + "in": "query", + "name": "should_trim_fields", + "description": "If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them.\nIf this parameter is not specified and the delimiter is pipe (`|`), the default value is true.\nOtherwise, the default value is false.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The maximum amount of time that the structure analysis can take.\nIf the analysis is still running when the timeout expires, it will be stopped.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timestamp_field", + "description": "The name of the field that contains the primary timestamp of each record in the text.\nIn particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field.\n\nIf the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`.\nTherefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified.\n\nFor structured text, if you specify this parameter, the field must exist within the text.\n\nIf this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field.\nFor structured text, it is not compulsory to have a timestamp in the text.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Field" + }, + "style": "form" + }, + { + "in": "query", + "name": "timestamp_format", + "description": "The Java time format of the timestamp field in the text.\nOnly a subset of Java time format letter groups are supported:\n\n* `a`\n* `d`\n* `dd`\n* `EEE`\n* `EEEE`\n* `H`\n* `HH`\n* `h`\n* `M`\n* `MM`\n* `MMM`\n* `MMMM`\n* `mm`\n* `ss`\n* `XX`\n* `XXX`\n* `yy`\n* `yyyy`\n* `zzz`\n\nAdditionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`).\nSpacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes.\nFor example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format.\n\nOne valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`.\nAnother is when the timestamp format is one that the structure finder does not consider by default.\n\nIf this parameter is not specified, the structure finder chooses the best format from a built-in set.\n\nIf the special value `null` is specified, the structure finder will not look for a primary timestamp in the text.\nWhen the format is semi-structured text, this will result in the structure finder treating the text as single-line messages.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "charset": { + "type": "string" + }, + "ecs_compatibility": { + "$ref": "#/components/schemas/text_structure._types:EcsCompatibilityType" + }, + "field_stats": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/text_structure._types:FieldStat" + } + }, + "format": { + "$ref": "#/components/schemas/text_structure._types:FormatType" + }, + "grok_pattern": { + "$ref": "#/components/schemas/_types:GrokPattern" + }, + "java_timestamp_formats": { + "type": "array", + "items": { + "type": "string" + } + }, + "joda_timestamp_formats": { + "type": "array", + "items": { + "type": "string" + } + }, + "ingest_pipeline": { + "$ref": "#/components/schemas/ingest._types:PipelineConfig" + }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping:TypeMapping" + }, + "multiline_start_pattern": { + "type": "string" + }, + "need_client_timezone": { + "type": "boolean" + }, + "num_lines_analyzed": { + "type": "number" + }, + "num_messages_analyzed": { + "type": "number" + }, + "sample_start": { + "type": "string" + }, + "timestamp_field": { + "$ref": "#/components/schemas/_types:Field" + } + }, + "required": [ + "charset", + "field_stats", + "format", + "ingest_pipeline", + "mappings", + "need_client_timezone", + "num_lines_analyzed", + "num_messages_analyzed", + "sample_start" + ] + } + } + } + } + } + } + }, + "/_text_structure/find_message_structure": { + "get": { + "tags": [ + "text_structure" + ], + "summary": "Find the structure of text messages", + "description": "Find the structure of a list of text messages.\nThe messages must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUse this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\nAppropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.", + "operationId": "text-structure-find-message-structure", + "parameters": [ + { + "$ref": "#/components/parameters/text_structure.find_message_structure#column_names" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#delimiter" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#ecs_compatibility" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#explain" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#format" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#grok_pattern" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#quote" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#should_trim_fields" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#timeout" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#timestamp_field" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#timestamp_format" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/text_structure.find_message_structure" + }, + "responses": { + "200": { + "$ref": "#/components/responses/text_structure.find_message_structure#200" + } + } + }, + "post": { + "tags": [ + "text_structure" + ], + "summary": "Find the structure of text messages", + "description": "Find the structure of a list of text messages.\nThe messages must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUse this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\nAppropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.", + "operationId": "text-structure-find-message-structure-1", + "parameters": [ + { + "$ref": "#/components/parameters/text_structure.find_message_structure#column_names" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#delimiter" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#ecs_compatibility" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#explain" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#format" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#grok_pattern" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#quote" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#should_trim_fields" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#timeout" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#timestamp_field" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure#timestamp_format" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/text_structure.find_message_structure" + }, + "responses": { + "200": { + "$ref": "#/components/responses/text_structure.find_message_structure#200" + } + } + } + }, "/_text_structure/find_structure": { "post": { "tags": [ @@ -34294,7 +34631,7 @@ { "in": "query", "name": "column_names", - "description": "If you have set format to delimited, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named \"column1\", \"column2\", \"column3\", etc.", + "description": "If you have set format to delimited, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named \"column1\", \"column2\", \"column3\", for example.", "deprecated": false, "schema": { "type": "string" @@ -34404,7 +34741,7 @@ { "in": "query", "name": "timeout", - "description": "Sets the maximum amount of time that the structure analysis make take. If the analysis is still running when the timeout expires then it will be aborted.", + "description": "Sets the maximum amount of time that the structure analysis can take. If the analysis is still running when the timeout expires then it will be stopped.", "deprecated": false, "schema": { "$ref": "#/components/schemas/_types:Duration" @@ -34468,7 +34805,7 @@ "field_stats": { "type": "object", "additionalProperties": { - "$ref": "#/components/schemas/text_structure.find_structure:FieldStat" + "$ref": "#/components/schemas/text_structure._types:FieldStat" } }, "sample_start": { @@ -86098,7 +86435,23 @@ "none" ] }, - "text_structure.find_structure:FieldStat": { + "text_structure._types:EcsCompatibilityType": { + "type": "string", + "enum": [ + "disabled", + "v1" + ] + }, + "text_structure._types:FormatType": { + "type": "string", + "enum": [ + "delimited", + "ndjson", + "semi_structured_text", + "xml" + ] + }, + "text_structure._types:FieldStat": { "type": "object", "properties": { "count": { @@ -86110,7 +86463,7 @@ "top_hits": { "type": "array", "items": { - "$ref": "#/components/schemas/text_structure.find_structure:TopHit" + "$ref": "#/components/schemas/text_structure._types:TopHit" } }, "mean_value": { @@ -86138,7 +86491,7 @@ "top_hits" ] }, - "text_structure.find_structure:TopHit": { + "text_structure._types:TopHit": { "type": "object", "properties": { "count": { @@ -93558,6 +93911,83 @@ } } }, + "text_structure.find_message_structure#200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "charset": { + "type": "string" + }, + "ecs_compatibility": { + "$ref": "#/components/schemas/text_structure._types:EcsCompatibilityType" + }, + "field_stats": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/text_structure._types:FieldStat" + } + }, + "format": { + "$ref": "#/components/schemas/text_structure._types:FormatType" + }, + "grok_pattern": { + "$ref": "#/components/schemas/_types:GrokPattern" + }, + "java_timestamp_formats": { + "type": "array", + "items": { + "type": "string" + } + }, + "joda_timestamp_formats": { + "type": "array", + "items": { + "type": "string" + } + }, + "ingest_pipeline": { + "$ref": "#/components/schemas/ingest._types:PipelineConfig" + }, + "mappings": { + "$ref": "#/components/schemas/_types.mapping:TypeMapping" + }, + "multiline_start_pattern": { + "type": "string" + }, + "need_client_timezone": { + "type": "boolean" + }, + "num_lines_analyzed": { + "type": "number" + }, + "num_messages_analyzed": { + "type": "number" + }, + "sample_start": { + "type": "string" + }, + "timestamp_field": { + "$ref": "#/components/schemas/_types:Field" + } + }, + "required": [ + "charset", + "field_stats", + "format", + "ingest_pipeline", + "mappings", + "need_client_timezone", + "num_lines_analyzed", + "num_messages_analyzed", + "sample_start" + ] + } + } + } + }, "text_structure.test_grok_pattern#200": { "description": "", "content": { @@ -102967,6 +103397,116 @@ }, "style": "form" }, + "text_structure.find_message_structure#column_names": { + "in": "query", + "name": "column_names", + "description": "If the format is `delimited`, you can specify the column names in a comma-separated list.\nIf this parameter is not specified, the structure finder uses the column names from the header row of the text.\nIf the text does not have a header role, columns are named \"column1\", \"column2\", \"column3\", for example.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + }, + "text_structure.find_message_structure#delimiter": { + "in": "query", + "name": "delimiter", + "description": "If you the format is `delimited`, you can specify the character used to delimit the values in each row.\nOnly a single character is supported; the delimiter cannot have multiple characters.\nBy default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`).\nIn this default scenario, all rows must have the same number of fields for the delimited format to be detected.\nIf you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + }, + "text_structure.find_message_structure#ecs_compatibility": { + "in": "query", + "name": "ecs_compatibility", + "description": "The mode of compatibility with ECS compliant Grok patterns.\nUse this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern.\nThis setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input.\nIf the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/text_structure._types:EcsCompatibilityType" + }, + "style": "form" + }, + "text_structure.find_message_structure#explain": { + "in": "query", + "name": "explain", + "description": "If this parameter is set to true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + "text_structure.find_message_structure#format": { + "in": "query", + "name": "format", + "description": "The high level structure of the text.\nBy default, the API chooses the format.\nIn this default scenario, all rows must have the same number of fields for a delimited format to be detected.\nIf the format is `delimited` and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/text_structure._types:FormatType" + }, + "style": "form" + }, + "text_structure.find_message_structure#grok_pattern": { + "in": "query", + "name": "grok_pattern", + "description": "If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text.\nThe name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter.\nIf that parameter is not specified, the name of the timestamp field in the Grok pattern must match \"timestamp\".\nIf `grok_pattern` is not specified, the structure finder creates a Grok pattern.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:GrokPattern" + }, + "style": "form" + }, + "text_structure.find_message_structure#quote": { + "in": "query", + "name": "quote", + "description": "If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character.\nOnly a single character is supported.\nIf this parameter is not specified, the default value is a double quote (`\"`).\nIf your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + }, + "text_structure.find_message_structure#should_trim_fields": { + "in": "query", + "name": "should_trim_fields", + "description": "If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them.\nIf this parameter is not specified and the delimiter is pipe (`|`), the default value is true.\nOtherwise, the default value is false.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + "text_structure.find_message_structure#timeout": { + "in": "query", + "name": "timeout", + "description": "The maximum amount of time that the structure analysis can take.\nIf the analysis is still running when the timeout expires, it will be stopped.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" + }, + "style": "form" + }, + "text_structure.find_message_structure#timestamp_field": { + "in": "query", + "name": "timestamp_field", + "description": "The name of the field that contains the primary timestamp of each record in the text.\nIn particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field.\n\nIf the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`.\nTherefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified.\n\nFor structured text, if you specify this parameter, the field must exist within the text.\n\nIf this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field.\nFor structured text, it is not compulsory to have a timestamp in the text.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Field" + }, + "style": "form" + }, + "text_structure.find_message_structure#timestamp_format": { + "in": "query", + "name": "timestamp_format", + "description": "The Java time format of the timestamp field in the text.\nOnly a subset of Java time format letter groups are supported:\n\n* `a`\n* `d`\n* `dd`\n* `EEE`\n* `EEEE`\n* `H`\n* `HH`\n* `h`\n* `M`\n* `MM`\n* `MMM`\n* `MMMM`\n* `mm`\n* `ss`\n* `XX`\n* `XXX`\n* `yy`\n* `yyyy`\n* `zzz`\n\nAdditionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`).\nSpacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes.\nFor example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format.\n\nOne valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`.\nAnother is when the timestamp format is one that the structure finder does not consider by default.\n\nIf this parameter is not specified, the structure finder chooses the best format from a built-in set.\n\nIf the special value `null` is specified, the structure finder will not look for a primary timestamp in the text.\nWhen the format is semi-structured text, this will result in the structure finder treating the text as single-line messages.", + "deprecated": false, + "schema": { + "type": "string" + }, + "style": "form" + }, "text_structure.test_grok_pattern#ecs_compatibility": { "in": "query", "name": "ecs_compatibility", @@ -105907,6 +106447,28 @@ } } }, + "text_structure.find_message_structure": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "messages": { + "description": "The list of messages you want to analyze.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "messages" + ] + } + } + }, + "required": true + }, "text_structure.test_grok_pattern": { "content": { "application/json": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 2e07d50702..9927e45bca 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -19383,12 +19383,24 @@ "visibility": "public" } }, - "description": "Finds the structure of a text field in an index.", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/find-field-structure.html", + "description": "Find the structure of a text field.\nFind the structure of a text field in an Elasticsearch index.", + "docId": "find-field-structure", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/find-field-structure.html", "name": "text_structure.find_field_structure", - "request": null, + "privileges": { + "cluster": [ + "monitor_text_structure" + ] + }, + "request": { + "name": "Request", + "namespace": "text_structure.find_field_structure" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "text_structure.find_field_structure" + }, "responseMediaType": [ "application/json" ], @@ -19408,15 +19420,27 @@ "visibility": "public" } }, - "description": "Finds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch.", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/find-message-structure.html", + "description": "Find the structure of text messages.\nFind the structure of a list of text messages.\nThe messages must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUse this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\nAppropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.", + "docId": "find-message-structure", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/find-message-structure.html", "name": "text_structure.find_message_structure", - "request": null, + "privileges": { + "cluster": [ + "monitor_text_structure" + ] + }, + "request": { + "name": "Request", + "namespace": "text_structure.find_message_structure" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "text_structure.find_message_structure" + }, "responseMediaType": [ "application/json" ], @@ -208916,11 +208940,27 @@ }, "specLocation": "tasks/list/ListTasksResponse.ts#L22-L24" }, + { + "kind": "enum", + "members": [ + { + "name": "disabled" + }, + { + "name": "v1" + } + ], + "name": { + "name": "EcsCompatibilityType", + "namespace": "text_structure._types" + }, + "specLocation": "text_structure/_types/Structure.ts#L40-L43" + }, { "kind": "interface", "name": { "name": "FieldStat", - "namespace": "text_structure.find_structure" + "namespace": "text_structure._types" }, "properties": [ { @@ -208954,7 +208994,7 @@ "kind": "instance_of", "type": { "name": "TopHit", - "namespace": "text_structure.find_structure" + "namespace": "text_structure._types" } } } @@ -209026,40 +209066,82 @@ } } ], - "specLocation": "text_structure/find_structure/types.ts#L23-L33" + "specLocation": "text_structure/_types/Structure.ts#L23-L33" }, { - "kind": "request", - "body": { - "kind": "value", - "codegenName": "text_files", - "value": { - "kind": "array_of", - "value": { + "kind": "enum", + "members": [ + { + "name": "delimited" + }, + { + "name": "ndjson" + }, + { + "name": "semi_structured_text" + }, + { + "name": "xml" + } + ], + "name": { + "name": "FormatType", + "namespace": "text_structure._types" + }, + "specLocation": "text_structure/_types/Structure.ts#L45-L50" + }, + { + "kind": "interface", + "name": { + "name": "TopHit", + "namespace": "text_structure._types" + }, + "properties": [ + { + "name": "count", + "required": true, + "type": { "kind": "instance_of", "type": { - "name": "TJsonDocument", - "namespace": "text_structure.find_structure.Request" + "name": "long", + "namespace": "_types" } } - } - }, - "description": "Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch.", - "generics": [ + }, { - "name": "TJsonDocument", - "namespace": "text_structure.find_structure.Request" + "name": "value", + "required": true, + "type": { + "kind": "user_defined_value" + } } ], + "specLocation": "text_structure/_types/Structure.ts#L35-L38" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Find the structure of a text field.\nFind the structure of a text field in an Elasticsearch index.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, "name": { "name": "Request", - "namespace": "text_structure.find_structure" + "namespace": "text_structure.find_field_structure" }, "path": [], "query": [ { - "description": "The text’s character set. It must be a character set that is supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE, windows-1252, or EUC-JP. If this parameter is not specified, the structure finder chooses an appropriate character set.", - "name": "charset", + "description": "If `format` is set to `delimited`, you can specify the column names in a comma-separated list.\nIf this parameter is not specified, the structure finder uses the column names from the header row of the text.\nIf the text does not have a header row, columns are named \"column1\", \"column2\", \"column3\", for example.", + "name": "column_names", "required": false, "type": { "kind": "instance_of", @@ -209070,8 +209152,8 @@ } }, { - "description": "If you have set format to delimited, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named \"column1\", \"column2\", \"column3\", etc.", - "name": "column_names", + "description": "If you have set `format` to `delimited`, you can specify the character used to delimit the values in each row.\nOnly a single character is supported; the delimiter cannot have multiple characters.\nBy default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`).\nIn this default scenario, all rows must have the same number of fields for the delimited format to be detected.\nIf you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row.", + "name": "delimiter", "required": false, "type": { "kind": "instance_of", @@ -209082,31 +209164,33 @@ } }, { - "description": "If you have set format to delimited, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row.", - "name": "delimiter", + "description": "The number of documents to include in the structural analysis.\nThe minimum value is 2.", + "name": "documents_to_sample", "required": false, + "serverDefault": 1000, "type": { "kind": "instance_of", "type": { - "name": "string", - "namespace": "_builtins" + "name": "uint", + "namespace": "_types" } } }, { - "description": "The mode of compatibility with ECS compliant Grok patterns (disabled or v1, default: disabled).", + "description": "The mode of compatibility with ECS compliant Grok patterns.\nUse this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern.\nThis setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input.\nIf the structure finder identifies a common structure but has no idea of the meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output.\nThe intention in that situation is that a user who knows the meanings will rename the fields before using them.", "name": "ecs_compatibility", "required": false, + "serverDefault": "disabled", "type": { "kind": "instance_of", "type": { - "name": "string", - "namespace": "_builtins" + "name": "EcsCompatibilityType", + "namespace": "text_structure._types" } } }, { - "description": "If this parameter is set to true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result.", + "description": "If true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result.", "name": "explain", "required": false, "serverDefault": false, @@ -209119,69 +209203,55 @@ } }, { - "description": "The high level structure of the text. Valid values are ndjson, xml, delimited, and semi_structured_text. By default, the API chooses the format. In this default scenario, all rows must have the same number of fields for a delimited format to be detected. If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row.", - "name": "format", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "If you have set format to semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match \"timestamp\". If grok_pattern is not specified, the structure finder creates a Grok pattern.", - "name": "grok_pattern", - "required": false, + "description": "The field that should be analyzed.", + "name": "field", + "required": true, "type": { "kind": "instance_of", "type": { - "name": "GrokPattern", + "name": "Field", "namespace": "_types" } } }, { - "description": "If you have set format to delimited, you can use this parameter to indicate whether the column names are in the first row of the text. If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows.", - "name": "has_header_row", + "description": "The high level structure of the text.\nBy default, the API chooses the format.\nIn this default scenario, all rows must have the same number of fields for a delimited format to be detected.\nIf the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row.", + "name": "format", "required": false, "type": { "kind": "instance_of", "type": { - "name": "boolean", - "namespace": "_builtins" + "name": "FormatType", + "namespace": "text_structure._types" } } }, { - "description": "The maximum number of characters in a message when lines are merged to form messages while analyzing semi-structured text. If you have extremely long messages you may need to increase this, but be aware that this may lead to very long processing times if the way to group lines into messages is misdetected.", - "name": "line_merge_size_limit", + "description": "If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text.\nThe name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter.\nIf that parameter is not specified, the name of the timestamp field in the Grok pattern must match \"timestamp\".\nIf `grok_pattern` is not specified, the structure finder creates a Grok pattern.", + "name": "grok_pattern", "required": false, - "serverDefault": 10000, "type": { "kind": "instance_of", "type": { - "name": "uint", + "name": "GrokPattern", "namespace": "_types" } } }, { - "description": "The number of lines to include in the structural analysis, starting from the beginning of the text. The minimum is 2; If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of the lines.", - "name": "lines_to_sample", - "required": false, - "serverDefault": 1000, + "description": "The name of the index that contains the analyzed field.", + "name": "index", + "required": true, "type": { "kind": "instance_of", "type": { - "name": "uint", + "name": "IndexName", "namespace": "_types" } } }, { - "description": "If you have set format to delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not specified, the default value is a double quote (\"). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample.", + "description": "If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character.\nOnly a single character is supported.\nIf this parameter is not specified, the default value is a double quote (`\"`).\nIf your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample.", "name": "quote", "required": false, "type": { @@ -209193,7 +209263,7 @@ } }, { - "description": "If you have set format to delimited, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (|), the default value is true. Otherwise, the default value is false.", + "description": "If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them.\nIf this parameter is not specified and the delimiter is pipe (`|`), the default value is true.\nOtherwise, the default value is false.", "name": "should_trim_fields", "required": false, "type": { @@ -209205,7 +209275,7 @@ } }, { - "description": "Sets the maximum amount of time that the structure analysis make take. If the analysis is still running when the timeout expires then it will be aborted.", + "description": "The maximum amount of time that the structure analysis can take.\nIf the analysis is still running when the timeout expires, it will be stopped.", "name": "timeout", "required": false, "serverDefault": "25s", @@ -209218,7 +209288,7 @@ } }, { - "description": "Optional parameter to specify the timestamp field in the file", + "description": "The name of the field that contains the primary timestamp of each record in the text.\nIn particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field.\n\nIf the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`.\nTherefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified.\n\nFor structured text, if you specify this parameter, the field must exist within the text.\n\nIf this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field.\nFor structured text, it is not compulsory to have a timestamp in the text.", "name": "timestamp_field", "required": false, "type": { @@ -209230,7 +209300,7 @@ } }, { - "description": "The Java time format of the timestamp field in the text.", + "description": "The Java time format of the timestamp field in the text.\nOnly a subset of Java time format letter groups are supported:\n\n* `a`\n* `d`\n* `dd`\n* `EEE`\n* `EEEE`\n* `H`\n* `HH`\n* `h`\n* `M`\n* `MM`\n* `MMM`\n* `MMMM`\n* `mm`\n* `ss`\n* `XX`\n* `XXX`\n* `yy`\n* `yyyy`\n* `zzz`\n\nAdditionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`).\nSpacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes.\nFor example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format.\n\nOne valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`.\nAnother is when the timestamp format is one that the structure finder does not consider by default.\n\nIf this parameter is not specified, the structure finder chooses the best format from a built-in set.\n\nIf the special value `null` is specified, the structure finder will not look for a primary timestamp in the text.\nWhen the format is semi-structured text, this will result in the structure finder treating the text as single-line messages.", "name": "timestamp_format", "required": false, "type": { @@ -209242,7 +209312,7 @@ } } ], - "specLocation": "text_structure/find_structure/FindStructureRequest.ts#L24-L75" + "specLocation": "text_structure/find_field_structure/FindFieldStructureRequest.ts#L26-L162" }, { "kind": "response", @@ -209261,35 +209331,13 @@ } }, { - "name": "has_header_row", + "name": "ecs_compatibility", "required": false, "type": { "kind": "instance_of", "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - }, - { - "name": "has_byte_order_marker", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - }, - { - "name": "format", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" + "name": "EcsCompatibilityType", + "namespace": "text_structure._types" } } }, @@ -209310,113 +209358,19 @@ "kind": "instance_of", "type": { "name": "FieldStat", - "namespace": "text_structure.find_structure" + "namespace": "text_structure._types" } } } }, { - "name": "sample_start", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "name": "num_messages_analyzed", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - }, - { - "name": "mappings", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "TypeMapping", - "namespace": "_types.mapping" - } - } - }, - { - "name": "quote", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "name": "delimiter", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "name": "need_client_timezone", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - }, - { - "name": "num_lines_analyzed", + "name": "format", "required": true, "type": { "kind": "instance_of", "type": { - "name": "integer", - "namespace": "_types" - } - } - }, - { - "name": "column_names", - "required": false, - "type": { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - } - }, - { - "name": "explanation", - "required": false, - "type": { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "name": "FormatType", + "namespace": "text_structure._types" } } }, @@ -209431,28 +209385,6 @@ } } }, - { - "name": "multiline_start_pattern", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "name": "exclude_lines_pattern", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, { "name": "java_timestamp_formats", "required": false, @@ -209481,6 +209413,83 @@ } } }, + { + "name": "ingest_pipeline", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "PipelineConfig", + "namespace": "ingest._types" + } + } + }, + { + "name": "mappings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + }, + { + "name": "multiline_start_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "need_client_timezone", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "num_lines_analyzed", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "num_messages_analyzed", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "sample_start", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, { "name": "timestamp_field", "required": false, @@ -209491,15 +209500,287 @@ "namespace": "_types" } } + } + ] + }, + "name": { + "name": "Response", + "namespace": "text_structure.find_field_structure" + }, + "specLocation": "text_structure/find_field_structure/FindFieldStructureResponse.ts#L31-L49" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "The list of messages you want to analyze.", + "name": "messages", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + ] + }, + "description": "Find the structure of text messages.\nFind the structure of a list of text messages.\nThe messages must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUse this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\nAppropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "text_structure.find_message_structure" + }, + "path": [], + "query": [ + { + "description": "If the format is `delimited`, you can specify the column names in a comma-separated list.\nIf this parameter is not specified, the structure finder uses the column names from the header row of the text.\nIf the text does not have a header role, columns are named \"column1\", \"column2\", \"column3\", for example.", + "name": "column_names", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "If you the format is `delimited`, you can specify the character used to delimit the values in each row.\nOnly a single character is supported; the delimiter cannot have multiple characters.\nBy default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`).\nIn this default scenario, all rows must have the same number of fields for the delimited format to be detected.\nIf you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row.", + "name": "delimiter", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The mode of compatibility with ECS compliant Grok patterns.\nUse this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern.\nThis setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input.\nIf the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it.", + "name": "ecs_compatibility", + "required": false, + "serverDefault": "disabled", + "type": { + "kind": "instance_of", + "type": { + "name": "EcsCompatibilityType", + "namespace": "text_structure._types" + } + } + }, + { + "description": "If this parameter is set to true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result.", + "name": "explain", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The high level structure of the text.\nBy default, the API chooses the format.\nIn this default scenario, all rows must have the same number of fields for a delimited format to be detected.\nIf the format is `delimited` and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row.", + "name": "format", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "FormatType", + "namespace": "text_structure._types" + } + } + }, + { + "description": "If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text.\nThe name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter.\nIf that parameter is not specified, the name of the timestamp field in the Grok pattern must match \"timestamp\".\nIf `grok_pattern` is not specified, the structure finder creates a Grok pattern.", + "name": "grok_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GrokPattern", + "namespace": "_types" + } + } + }, + { + "description": "If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character.\nOnly a single character is supported.\nIf this parameter is not specified, the default value is a double quote (`\"`).\nIf your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample.", + "name": "quote", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them.\nIf this parameter is not specified and the delimiter is pipe (`|`), the default value is true.\nOtherwise, the default value is false.", + "name": "should_trim_fields", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The maximum amount of time that the structure analysis can take.\nIf the analysis is still running when the timeout expires, it will be stopped.", + "name": "timeout", + "required": false, + "serverDefault": "25s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The name of the field that contains the primary timestamp of each record in the text.\nIn particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field.\n\nIf the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`.\nTherefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified.\n\nFor structured text, if you specify this parameter, the field must exist within the text.\n\nIf this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field.\nFor structured text, it is not compulsory to have a timestamp in the text.", + "name": "timestamp_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + } + }, + { + "description": "The Java time format of the timestamp field in the text.\nOnly a subset of Java time format letter groups are supported:\n\n* `a`\n* `d`\n* `dd`\n* `EEE`\n* `EEEE`\n* `H`\n* `HH`\n* `h`\n* `M`\n* `MM`\n* `MMM`\n* `MMMM`\n* `mm`\n* `ss`\n* `XX`\n* `XXX`\n* `yy`\n* `yyyy`\n* `zzz`\n\nAdditionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`).\nSpacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes.\nFor example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format.\n\nOne valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`.\nAnother is when the timestamp format is one that the structure finder does not consider by default.\n\nIf this parameter is not specified, the structure finder chooses the best format from a built-in set.\n\nIf the special value `null` is specified, the structure finder will not look for a primary timestamp in the text.\nWhen the format is semi-structured text, this will result in the structure finder treating the text as single-line messages.", + "name": "timestamp_format", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "text_structure/find_message_structure/FindMessageStructureRequest.ts#L25-L163" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "charset", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } }, { - "name": "should_trim_fields", + "name": "ecs_compatibility", "required": false, "type": { "kind": "instance_of", "type": { - "name": "boolean", - "namespace": "_builtins" + "name": "EcsCompatibilityType", + "namespace": "text_structure._types" + } + } + }, + { + "name": "field_stats", + "required": true, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "FieldStat", + "namespace": "text_structure._types" + } + } + } + }, + { + "name": "format", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "FormatType", + "namespace": "text_structure._types" + } + } + }, + { + "name": "grok_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GrokPattern", + "namespace": "_types" + } + } + }, + { + "name": "java_timestamp_formats", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "name": "joda_timestamp_formats", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } } } }, @@ -209513,42 +209794,585 @@ "namespace": "ingest._types" } } + }, + { + "name": "mappings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + }, + { + "name": "multiline_start_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "need_client_timezone", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "num_lines_analyzed", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "num_messages_analyzed", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "sample_start", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "timestamp_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + } } ] }, "name": { "name": "Response", - "namespace": "text_structure.find_structure" + "namespace": "text_structure.find_message_structure" }, - "specLocation": "text_structure/find_structure/FindStructureResponse.ts#L27-L52" + "specLocation": "text_structure/find_message_structure/FindMessageStructureResponse.ts#L31-L49" }, { - "kind": "interface", + "kind": "request", + "body": { + "kind": "value", + "codegenName": "text_files", + "value": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "TJsonDocument", + "namespace": "text_structure.find_structure.Request" + } + } + } + }, + "description": "Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch.", + "generics": [ + { + "name": "TJsonDocument", + "namespace": "text_structure.find_structure.Request" + } + ], "name": { - "name": "TopHit", + "name": "Request", "namespace": "text_structure.find_structure" }, - "properties": [ + "path": [], + "query": [ { - "name": "count", - "required": true, + "description": "The text’s character set. It must be a character set that is supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE, windows-1252, or EUC-JP. If this parameter is not specified, the structure finder chooses an appropriate character set.", + "name": "charset", + "required": false, "type": { "kind": "instance_of", "type": { - "name": "long", + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "If you have set format to delimited, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named \"column1\", \"column2\", \"column3\", for example.", + "name": "column_names", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "If you have set format to delimited, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row.", + "name": "delimiter", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The mode of compatibility with ECS compliant Grok patterns (disabled or v1, default: disabled).", + "name": "ecs_compatibility", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "If this parameter is set to true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result.", + "name": "explain", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The high level structure of the text. Valid values are ndjson, xml, delimited, and semi_structured_text. By default, the API chooses the format. In this default scenario, all rows must have the same number of fields for a delimited format to be detected. If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row.", + "name": "format", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "If you have set format to semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match \"timestamp\". If grok_pattern is not specified, the structure finder creates a Grok pattern.", + "name": "grok_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GrokPattern", "namespace": "_types" } } }, { - "name": "value", - "required": true, + "description": "If you have set format to delimited, you can use this parameter to indicate whether the column names are in the first row of the text. If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows.", + "name": "has_header_row", + "required": false, "type": { - "kind": "user_defined_value" + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The maximum number of characters in a message when lines are merged to form messages while analyzing semi-structured text. If you have extremely long messages you may need to increase this, but be aware that this may lead to very long processing times if the way to group lines into messages is misdetected.", + "name": "line_merge_size_limit", + "required": false, + "serverDefault": 10000, + "type": { + "kind": "instance_of", + "type": { + "name": "uint", + "namespace": "_types" + } + } + }, + { + "description": "The number of lines to include in the structural analysis, starting from the beginning of the text. The minimum is 2; If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of the lines.", + "name": "lines_to_sample", + "required": false, + "serverDefault": 1000, + "type": { + "kind": "instance_of", + "type": { + "name": "uint", + "namespace": "_types" + } + } + }, + { + "description": "If you have set format to delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not specified, the default value is a double quote (\"). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample.", + "name": "quote", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "If you have set format to delimited, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (|), the default value is true. Otherwise, the default value is false.", + "name": "should_trim_fields", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "Sets the maximum amount of time that the structure analysis can take. If the analysis is still running when the timeout expires then it will be stopped.", + "name": "timeout", + "required": false, + "serverDefault": "25s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "Optional parameter to specify the timestamp field in the file", + "name": "timestamp_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + } + }, + { + "description": "The Java time format of the timestamp field in the text.", + "name": "timestamp_format", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } } } ], - "specLocation": "text_structure/find_structure/types.ts#L35-L38" + "specLocation": "text_structure/find_structure/FindStructureRequest.ts#L24-L75" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "charset", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "has_header_row", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "has_byte_order_marker", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "format", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "field_stats", + "required": true, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "FieldStat", + "namespace": "text_structure._types" + } + } + } + }, + { + "name": "sample_start", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "num_messages_analyzed", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "mappings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "TypeMapping", + "namespace": "_types.mapping" + } + } + }, + { + "name": "quote", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "delimiter", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "need_client_timezone", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "num_lines_analyzed", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "column_names", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "name": "explanation", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "name": "grok_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GrokPattern", + "namespace": "_types" + } + } + }, + { + "name": "multiline_start_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "exclude_lines_pattern", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "java_timestamp_formats", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "name": "joda_timestamp_formats", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "name": "timestamp_field", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + } + }, + { + "name": "should_trim_fields", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "ingest_pipeline", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "PipelineConfig", + "namespace": "ingest._types" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "text_structure.find_structure" + }, + "specLocation": "text_structure/find_structure/FindStructureResponse.ts#L27-L52" }, { "kind": "interface", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index cca4836eca..c5f94a1880 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -1076,18 +1076,6 @@ ], "response": [] }, - "text_structure.find_field_structure": { - "request": [ - "Missing request & response" - ], - "response": [] - }, - "text_structure.find_message_structure": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "transform.get_node_stats": { "request": [ "Missing request & response" diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 7ba849a982..85d98757d6 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -19803,10 +19803,12 @@ export interface TasksListRequest extends RequestBase { export type TasksListResponse = TasksTaskListResponseBase -export interface TextStructureFindStructureFieldStat { +export type TextStructureEcsCompatibilityType = 'disabled' | 'v1' + +export interface TextStructureFieldStat { count: integer cardinality: integer - top_hits: TextStructureFindStructureTopHit[] + top_hits: TextStructureTopHit[] mean_value?: integer median_value?: integer max_value?: integer @@ -19815,6 +19817,83 @@ export interface TextStructureFindStructureFieldStat { latest?: string } +export type TextStructureFormatType = 'delimited' | 'ndjson' | 'semi_structured_text' | 'xml' + +export interface TextStructureTopHit { + count: long + value: any +} + +export interface TextStructureFindFieldStructureRequest extends RequestBase { + column_names?: string + delimiter?: string + documents_to_sample?: uint + ecs_compatibility?: TextStructureEcsCompatibilityType + explain?: boolean + field: Field + format?: TextStructureFormatType + grok_pattern?: GrokPattern + index: IndexName + quote?: string + should_trim_fields?: boolean + timeout?: Duration + timestamp_field?: Field + timestamp_format?: string +} + +export interface TextStructureFindFieldStructureResponse { + charset: string + ecs_compatibility?: TextStructureEcsCompatibilityType + field_stats: Record + format: TextStructureFormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: IngestPipelineConfig + mappings: MappingTypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field +} + +export interface TextStructureFindMessageStructureRequest extends RequestBase { + column_names?: string + delimiter?: string + ecs_compatibility?: TextStructureEcsCompatibilityType + explain?: boolean + format?: TextStructureFormatType + grok_pattern?: GrokPattern + quote?: string + should_trim_fields?: boolean + timeout?: Duration + timestamp_field?: Field + timestamp_format?: string + body?: { + messages: string[] + } +} + +export interface TextStructureFindMessageStructureResponse { + charset: string + ecs_compatibility?: TextStructureEcsCompatibilityType + field_stats: Record + format: TextStructureFormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: IngestPipelineConfig + mappings: MappingTypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field +} + export interface TextStructureFindStructureRequest { charset?: string column_names?: string @@ -19839,7 +19918,7 @@ export interface TextStructureFindStructureResponse { has_header_row?: boolean has_byte_order_marker: boolean format: string - field_stats: Record + field_stats: Record sample_start: string num_messages_analyzed: integer mappings: MappingTypeMapping @@ -19859,11 +19938,6 @@ export interface TextStructureFindStructureResponse { ingest_pipeline: IngestPipelineConfig } -export interface TextStructureFindStructureTopHit { - count: long - value: any -} - export interface TextStructureTestGrokPatternMatchedField { match: string offset: integer diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index e3c05d674d..bf09738b32 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -168,6 +168,8 @@ explain-dfanalytics,https://www.elastic.co/guide/en/elasticsearch/reference/{bra fail-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/fail-processor.html field-and-document-access-control,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/field-and-document-access-control.html field-usage-stats,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/field-usage-stats.html +find-field-structure,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/find-field-structure.html +find-message-structure,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/find-message-structure.html find-structure,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/find-structure.html fingerprint-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/fingerprint-processor.html foreach-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/foreach-processor.html diff --git a/specification/text_structure/find_structure/types.ts b/specification/text_structure/_types/Structure.ts similarity index 89% rename from specification/text_structure/find_structure/types.ts rename to specification/text_structure/_types/Structure.ts index 2ba85e0c30..056550d2ae 100644 --- a/specification/text_structure/find_structure/types.ts +++ b/specification/text_structure/_types/Structure.ts @@ -36,3 +36,15 @@ export class TopHit { count: long value: UserDefinedValue } + +export enum EcsCompatibilityType { + disabled, + v1 +} + +export enum FormatType { + delimited, + ndjson, + semi_structured_text, + xml +} diff --git a/specification/text_structure/find_field_structure/FindFieldStructureRequest.ts b/specification/text_structure/find_field_structure/FindFieldStructureRequest.ts new file mode 100644 index 0000000000..91896ed653 --- /dev/null +++ b/specification/text_structure/find_field_structure/FindFieldStructureRequest.ts @@ -0,0 +1,162 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Field, GrokPattern, IndexName } from '@_types/common' +import { uint } from '@_types/Numeric' +import { Duration } from '@_types/Time' +import { EcsCompatibilityType, FormatType } from '../_types/Structure' + +/** + * Find the structure of a text field. + * Find the structure of a text field in an Elasticsearch index. + * @rest_spec_name text_structure.find_field_structure + * @availability stack stability=stable visibility=public + * @cluster_privileges monitor_text_structure + * @doc_id find-field-structure + */ +interface Request extends RequestBase { + query_parameters: { + /** + * If `format` is set to `delimited`, you can specify the column names in a comma-separated list. + * If this parameter is not specified, the structure finder uses the column names from the header row of the text. + * If the text does not have a header row, columns are named "column1", "column2", "column3", for example. + */ + column_names?: string + /** + * If you have set `format` to `delimited`, you can specify the character used to delimit the values in each row. + * Only a single character is supported; the delimiter cannot have multiple characters. + * By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). + * In this default scenario, all rows must have the same number of fields for the delimited format to be detected. + * If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. + */ + delimiter?: string + /** + * The number of documents to include in the structural analysis. + * The minimum value is 2. + * @server_default 1000 + */ + documents_to_sample?: uint + /** + * The mode of compatibility with ECS compliant Grok patterns. + * Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. + * This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. + * If the structure finder identifies a common structure but has no idea of the meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output. + * The intention in that situation is that a user who knows the meanings will rename the fields before using them. + * @server_default disabled + */ + ecs_compatibility?: EcsCompatibilityType + /** + * If true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result. + * @server_default false + */ + explain?: boolean + /** + * The field that should be analyzed. + */ + field: Field + /** + * The high level structure of the text. + * By default, the API chooses the format. + * In this default scenario, all rows must have the same number of fields for a delimited format to be detected. + * If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. + */ + format?: FormatType + /** + * If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. + * The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. + * If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". + * If `grok_pattern` is not specified, the structure finder creates a Grok pattern. + */ + grok_pattern?: GrokPattern + /** + * The name of the index that contains the analyzed field. + */ + index: IndexName + /** + * If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. + * Only a single character is supported. + * If this parameter is not specified, the default value is a double quote (`"`). + * If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. + */ + quote?: string + /** + * If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. + * If this parameter is not specified and the delimiter is pipe (`|`), the default value is true. + * Otherwise, the default value is false. + */ + should_trim_fields?: boolean + /** + * The maximum amount of time that the structure analysis can take. + * If the analysis is still running when the timeout expires, it will be stopped. + * @server_default 25s + */ + timeout?: Duration + /** + * The name of the field that contains the primary timestamp of each record in the text. + * In particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field. + * + * If the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. + * Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. + * + * For structured text, if you specify this parameter, the field must exist within the text. + * + * If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + * For structured text, it is not compulsory to have a timestamp in the text. + */ + timestamp_field?: Field + /** + * The Java time format of the timestamp field in the text. + * Only a subset of Java time format letter groups are supported: + * + * * `a` + * * `d` + * * `dd` + * * `EEE` + * * `EEEE` + * * `H` + * * `HH` + * * `h` + * * `M` + * * `MM` + * * `MMM` + * * `MMMM` + * * `mm` + * * `ss` + * * `XX` + * * `XXX` + * * `yy` + * * `yyyy` + * * `zzz` + * + * Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`). + * Spacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes. + * For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. + * + * One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. + * Another is when the timestamp format is one that the structure finder does not consider by default. + * + * If this parameter is not specified, the structure finder chooses the best format from a built-in set. + * + * If the special value `null` is specified, the structure finder will not look for a primary timestamp in the text. + * When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. + */ + timestamp_format?: string + } +} diff --git a/specification/text_structure/find_field_structure/FindFieldStructureResponse.ts b/specification/text_structure/find_field_structure/FindFieldStructureResponse.ts new file mode 100644 index 0000000000..258bb7e146 --- /dev/null +++ b/specification/text_structure/find_field_structure/FindFieldStructureResponse.ts @@ -0,0 +1,49 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { PipelineConfig } from '@ingest/_types/Pipeline' +import { Dictionary } from '@spec_utils/Dictionary' +import { Field, GrokPattern } from '@_types/common' +import { TypeMapping } from '@_types/mapping/TypeMapping' +import { integer } from '@_types/Numeric' +import { + EcsCompatibilityType, + FieldStat, + FormatType +} from '../_types/Structure' + +export class Response { + body: { + charset: string + ecs_compatibility?: EcsCompatibilityType + field_stats: Dictionary + format: FormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: PipelineConfig + mappings: TypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field + } +} diff --git a/specification/text_structure/find_message_structure/FindMessageStructureRequest.ts b/specification/text_structure/find_message_structure/FindMessageStructureRequest.ts new file mode 100644 index 0000000000..df08f3fe29 --- /dev/null +++ b/specification/text_structure/find_message_structure/FindMessageStructureRequest.ts @@ -0,0 +1,163 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Field, GrokPattern } from '@_types/common' +import { Duration } from '@_types/Time' +import { EcsCompatibilityType, FormatType } from '../_types/Structure' + +/** + * Find the structure of text messages. + * Find the structure of a list of text messages. + * The messages must contain data that is suitable to be ingested into Elasticsearch. + * + * This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + * Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process. + * The response from the API contains: + * + * * Sample messages. + * * Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields. + * * Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. + * Appropriate mappings for an Elasticsearch index, which you could use to ingest the text. + * + * All this information can be calculated by the structure finder with no guidance. + * However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters. + * @rest_spec_name text_structure.find_message_structure + * @availability stack stability=stable visibility=public + * @cluster_privileges monitor_text_structure + * @doc_id find-message-structure + */ +interface Request extends RequestBase { + query_parameters: { + /** If the format is `delimited`, you can specify the column names in a comma-separated list. + * If this parameter is not specified, the structure finder uses the column names from the header row of the text. + * If the text does not have a header role, columns are named "column1", "column2", "column3", for example. + */ + column_names?: string + /** + * If you the format is `delimited`, you can specify the character used to delimit the values in each row. + * Only a single character is supported; the delimiter cannot have multiple characters. + * By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (`|`). + * In this default scenario, all rows must have the same number of fields for the delimited format to be detected. + * If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. + */ + delimiter?: string + /** + * The mode of compatibility with ECS compliant Grok patterns. + * Use this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern. + * This setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input. + * If the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it. + * @server_default disabled + */ + ecs_compatibility?: EcsCompatibilityType + /** + * If this parameter is set to true, the response includes a field named `explanation`, which is an array of strings that indicate how the structure finder produced its result. + * @server_default false + */ + explain?: boolean + /** The high level structure of the text. + * By default, the API chooses the format. + * In this default scenario, all rows must have the same number of fields for a delimited format to be detected. + * If the format is `delimited` and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row. + */ + format?: FormatType + /** + * If the format is `semi_structured_text`, you can specify a Grok pattern that is used to extract fields from every message in the text. + * The name of the timestamp field in the Grok pattern must match what is specified in the `timestamp_field` parameter. + * If that parameter is not specified, the name of the timestamp field in the Grok pattern must match "timestamp". + * If `grok_pattern` is not specified, the structure finder creates a Grok pattern. + */ + grok_pattern?: GrokPattern + /** + * If the format is `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. + * Only a single character is supported. + * If this parameter is not specified, the default value is a double quote (`"`). + * If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. + */ + quote?: string + /** + * If the format is `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. + * If this parameter is not specified and the delimiter is pipe (`|`), the default value is true. + * Otherwise, the default value is false. + */ + should_trim_fields?: boolean + /** + * The maximum amount of time that the structure analysis can take. + * If the analysis is still running when the timeout expires, it will be stopped. + * @server_default 25s + */ + timeout?: Duration + /** + * The name of the field that contains the primary timestamp of each record in the text. + * In particular, if the text was ingested into an index, this is the field that would be used to populate the `@timestamp` field. + * + * If the format is `semi_structured_text`, this field must match the name of the appropriate extraction in the `grok_pattern`. + * Therefore, for semi-structured text, it is best not to specify this parameter unless `grok_pattern` is also specified. + * + * For structured text, if you specify this parameter, the field must exist within the text. + * + * If this parameter is not specified, the structure finder makes a decision about which field (if any) is the primary timestamp field. + * For structured text, it is not compulsory to have a timestamp in the text. + */ + timestamp_field?: Field + /** + * The Java time format of the timestamp field in the text. + * Only a subset of Java time format letter groups are supported: + * + * * `a` + * * `d` + * * `dd` + * * `EEE` + * * `EEEE` + * * `H` + * * `HH` + * * `h` + * * `M` + * * `MM` + * * `MMM` + * * `MMMM` + * * `mm` + * * `ss` + * * `XX` + * * `XXX` + * * `yy` + * * `yyyy` + * * `zzz` + * + * Additionally `S` letter groups (fractional seconds) of length one to nine are supported providing they occur after `ss` and are separated from the `ss` by a period (`.`), comma (`,`), or colon (`:`). + * Spacing and punctuation is also permitted with the exception a question mark (`?`), newline, and carriage return, together with literal text enclosed in single quotes. + * For example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. + * + * One valuable use case for this parameter is when the format is semi-structured text, there are multiple timestamp formats in the text, and you know which format corresponds to the primary timestamp, but you do not want to specify the full `grok_pattern`. + * Another is when the timestamp format is one that the structure finder does not consider by default. + * + * If this parameter is not specified, the structure finder chooses the best format from a built-in set. + * + * If the special value `null` is specified, the structure finder will not look for a primary timestamp in the text. + * When the format is semi-structured text, this will result in the structure finder treating the text as single-line messages. + */ + timestamp_format?: string + } + body: { + /** + * The list of messages you want to analyze. + */ + messages: Array + } +} diff --git a/specification/text_structure/find_message_structure/FindMessageStructureResponse.ts b/specification/text_structure/find_message_structure/FindMessageStructureResponse.ts new file mode 100644 index 0000000000..258bb7e146 --- /dev/null +++ b/specification/text_structure/find_message_structure/FindMessageStructureResponse.ts @@ -0,0 +1,49 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { PipelineConfig } from '@ingest/_types/Pipeline' +import { Dictionary } from '@spec_utils/Dictionary' +import { Field, GrokPattern } from '@_types/common' +import { TypeMapping } from '@_types/mapping/TypeMapping' +import { integer } from '@_types/Numeric' +import { + EcsCompatibilityType, + FieldStat, + FormatType +} from '../_types/Structure' + +export class Response { + body: { + charset: string + ecs_compatibility?: EcsCompatibilityType + field_stats: Dictionary + format: FormatType + grok_pattern?: GrokPattern + java_timestamp_formats?: string[] + joda_timestamp_formats?: string[] + ingest_pipeline: PipelineConfig + mappings: TypeMapping + multiline_start_pattern?: string + need_client_timezone: boolean + num_lines_analyzed: integer + num_messages_analyzed: integer + sample_start: string + timestamp_field?: Field + } +} diff --git a/specification/text_structure/find_structure/FindStructureRequest.ts b/specification/text_structure/find_structure/FindStructureRequest.ts index ae48be2faf..94544f0ce8 100644 --- a/specification/text_structure/find_structure/FindStructureRequest.ts +++ b/specification/text_structure/find_structure/FindStructureRequest.ts @@ -30,7 +30,7 @@ export interface Request { query_parameters: { /** The text’s character set. It must be a character set that is supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE, windows-1252, or EUC-JP. If this parameter is not specified, the structure finder chooses an appropriate character set. */ charset?: string - /** If you have set format to delimited, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named "column1", "column2", "column3", etc. */ + /** If you have set format to delimited, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named "column1", "column2", "column3", for example. */ column_names?: string /** If you have set format to delimited, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row. */ delimiter?: string @@ -62,7 +62,7 @@ export interface Request { /** If you have set format to delimited, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (|), the default value is true. Otherwise, the default value is false. */ should_trim_fields?: boolean /** - * Sets the maximum amount of time that the structure analysis make take. If the analysis is still running when the timeout expires then it will be aborted. + * Sets the maximum amount of time that the structure analysis can take. If the analysis is still running when the timeout expires then it will be stopped. * @server_default 25s */ timeout?: Duration diff --git a/specification/text_structure/find_structure/FindStructureResponse.ts b/specification/text_structure/find_structure/FindStructureResponse.ts index b6fb84d5a9..b3cdeb9160 100644 --- a/specification/text_structure/find_structure/FindStructureResponse.ts +++ b/specification/text_structure/find_structure/FindStructureResponse.ts @@ -22,7 +22,7 @@ import { Dictionary } from '@spec_utils/Dictionary' import { Field, GrokPattern } from '@_types/common' import { TypeMapping } from '@_types/mapping/TypeMapping' import { integer } from '@_types/Numeric' -import { FieldStat } from './types' +import { FieldStat } from '../_types/Structure' export class Response { body: {