elasticsearch 8.17.0__py3-none-any.whl → 8.17.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. elasticsearch/_async/client/__init__.py +153 -51
  2. elasticsearch/_async/client/cat.py +64 -195
  3. elasticsearch/_async/client/cluster.py +19 -19
  4. elasticsearch/_async/client/connector.py +337 -0
  5. elasticsearch/_async/client/dangling_indices.py +3 -3
  6. elasticsearch/_async/client/ilm.py +6 -6
  7. elasticsearch/_async/client/indices.py +360 -81
  8. elasticsearch/_async/client/inference.py +94 -1
  9. elasticsearch/_async/client/ingest.py +175 -2
  10. elasticsearch/_async/client/logstash.py +9 -6
  11. elasticsearch/_async/client/migration.py +16 -7
  12. elasticsearch/_async/client/ml.py +12 -6
  13. elasticsearch/_async/client/monitoring.py +2 -1
  14. elasticsearch/_async/client/nodes.py +3 -3
  15. elasticsearch/_async/client/query_rules.py +33 -12
  16. elasticsearch/_async/client/rollup.py +88 -13
  17. elasticsearch/_async/client/search_application.py +130 -1
  18. elasticsearch/_async/client/searchable_snapshots.py +32 -23
  19. elasticsearch/_async/client/security.py +676 -55
  20. elasticsearch/_async/client/shutdown.py +38 -15
  21. elasticsearch/_async/client/simulate.py +151 -0
  22. elasticsearch/_async/client/slm.py +138 -19
  23. elasticsearch/_async/client/snapshot.py +307 -23
  24. elasticsearch/_async/client/sql.py +66 -46
  25. elasticsearch/_async/client/synonyms.py +39 -19
  26. elasticsearch/_async/client/tasks.py +68 -28
  27. elasticsearch/_async/client/text_structure.py +466 -46
  28. elasticsearch/_async/client/transform.py +9 -2
  29. elasticsearch/_async/client/watcher.py +207 -41
  30. elasticsearch/_async/client/xpack.py +11 -6
  31. elasticsearch/_sync/client/__init__.py +153 -51
  32. elasticsearch/_sync/client/cat.py +64 -195
  33. elasticsearch/_sync/client/cluster.py +19 -19
  34. elasticsearch/_sync/client/connector.py +337 -0
  35. elasticsearch/_sync/client/dangling_indices.py +3 -3
  36. elasticsearch/_sync/client/ilm.py +6 -6
  37. elasticsearch/_sync/client/indices.py +360 -81
  38. elasticsearch/_sync/client/inference.py +94 -1
  39. elasticsearch/_sync/client/ingest.py +175 -2
  40. elasticsearch/_sync/client/logstash.py +9 -6
  41. elasticsearch/_sync/client/migration.py +16 -7
  42. elasticsearch/_sync/client/ml.py +12 -6
  43. elasticsearch/_sync/client/monitoring.py +2 -1
  44. elasticsearch/_sync/client/nodes.py +3 -3
  45. elasticsearch/_sync/client/query_rules.py +33 -12
  46. elasticsearch/_sync/client/rollup.py +88 -13
  47. elasticsearch/_sync/client/search_application.py +130 -1
  48. elasticsearch/_sync/client/searchable_snapshots.py +32 -23
  49. elasticsearch/_sync/client/security.py +676 -55
  50. elasticsearch/_sync/client/shutdown.py +38 -15
  51. elasticsearch/_sync/client/simulate.py +151 -0
  52. elasticsearch/_sync/client/slm.py +138 -19
  53. elasticsearch/_sync/client/snapshot.py +307 -23
  54. elasticsearch/_sync/client/sql.py +66 -46
  55. elasticsearch/_sync/client/synonyms.py +39 -19
  56. elasticsearch/_sync/client/tasks.py +68 -28
  57. elasticsearch/_sync/client/text_structure.py +466 -46
  58. elasticsearch/_sync/client/transform.py +9 -2
  59. elasticsearch/_sync/client/watcher.py +207 -41
  60. elasticsearch/_sync/client/xpack.py +11 -6
  61. elasticsearch/_version.py +1 -1
  62. elasticsearch/client.py +2 -0
  63. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/METADATA +1 -1
  64. elasticsearch-8.17.1.dist-info/RECORD +119 -0
  65. elasticsearch-8.17.0.dist-info/RECORD +0 -117
  66. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/WHEEL +0 -0
  67. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/licenses/LICENSE +0 -0
  68. {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.1.dist-info}/licenses/NOTICE +0 -0
@@ -25,6 +25,366 @@ from .utils import _rewrite_parameters
25
25
 
26
26
  class TextStructureClient(NamespacedClient):
27
27
 
28
+ @_rewrite_parameters()
29
+ def find_field_structure(
30
+ self,
31
+ *,
32
+ field: str,
33
+ index: str,
34
+ column_names: t.Optional[str] = None,
35
+ delimiter: t.Optional[str] = None,
36
+ documents_to_sample: t.Optional[int] = None,
37
+ ecs_compatibility: t.Optional[t.Union[str, t.Literal["disabled", "v1"]]] = None,
38
+ error_trace: t.Optional[bool] = None,
39
+ explain: t.Optional[bool] = None,
40
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
41
+ format: t.Optional[
42
+ t.Union[
43
+ str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"]
44
+ ]
45
+ ] = None,
46
+ grok_pattern: t.Optional[str] = None,
47
+ human: t.Optional[bool] = None,
48
+ pretty: t.Optional[bool] = None,
49
+ quote: t.Optional[str] = None,
50
+ should_trim_fields: t.Optional[bool] = None,
51
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
52
+ timestamp_field: t.Optional[str] = None,
53
+ timestamp_format: t.Optional[str] = None,
54
+ ) -> ObjectApiResponse[t.Any]:
55
+ """
56
+ Find the structure of a text field. Find the structure of a text field in an
57
+ Elasticsearch index. This API provides a starting point for extracting further
58
+ information from log messages already ingested into Elasticsearch. For example,
59
+ if you have ingested data into a very simple index that has just `@timestamp`
60
+ and message fields, you can use this API to see what common structure exists
61
+ in the message field. The response from the API contains: * Sample messages.
62
+ * Statistics that reveal the most common values for all fields detected within
63
+ the text and basic numeric statistics for numeric fields. * Information about
64
+ the structure of the text, which is useful when you write ingest configurations
65
+ to index it or similarly formatted text. * Appropriate mappings for an Elasticsearch
66
+ index, which you could use to ingest the text. All this information can be calculated
67
+ by the structure finder with no guidance. However, you can optionally override
68
+ some of the decisions about the text structure by specifying one or more query
69
+ parameters. If the structure finder produces unexpected results, specify the
70
+ `explain` query parameter and an explanation will appear in the response. It
71
+ helps determine why the returned structure was chosen.
72
+
73
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/find-field-structure.html>`_
74
+
75
+ :param field: The field that should be analyzed.
76
+ :param index: The name of the index that contains the analyzed field.
77
+ :param column_names: If `format` is set to `delimited`, you can specify the column
78
+ names in a comma-separated list. If this parameter is not specified, the
79
+ structure finder uses the column names from the header row of the text. If
80
+ the text does not have a header row, columns are named "column1", "column2",
81
+ "column3", for example.
82
+ :param delimiter: If you have set `format` to `delimited`, you can specify the
83
+ character used to delimit the values in each row. Only a single character
84
+ is supported; the delimiter cannot have multiple characters. By default,
85
+ the API considers the following possibilities: comma, tab, semi-colon, and
86
+ pipe (`|`). In this default scenario, all rows must have the same number
87
+ of fields for the delimited format to be detected. If you specify a delimiter,
88
+ up to 10% of the rows can have a different number of columns than the first
89
+ row.
90
+ :param documents_to_sample: The number of documents to include in the structural
91
+ analysis. The minimum value is 2.
92
+ :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns.
93
+ Use this parameter to specify whether to use ECS Grok patterns instead of
94
+ legacy ones when the structure finder creates a Grok pattern. This setting
95
+ primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}`
96
+ matches the input. If the structure finder identifies a common structure
97
+ but has no idea of the meaning then generic field names such as `path`, `ipaddress`,
98
+ `field1`, and `field2` are used in the `grok_pattern` output. The intention
99
+ in that situation is that a user who knows the meanings will rename the fields
100
+ before using them.
101
+ :param explain: If `true`, the response includes a field named `explanation`,
102
+ which is an array of strings that indicate how the structure finder produced
103
+ its result.
104
+ :param format: The high level structure of the text. By default, the API chooses
105
+ the format. In this default scenario, all rows must have the same number
106
+ of fields for a delimited format to be detected. If the format is set to
107
+ delimited and the delimiter is not set, however, the API tolerates up to
108
+ 5% of rows that have a different number of columns than the first row.
109
+ :param grok_pattern: If the format is `semi_structured_text`, you can specify
110
+ a Grok pattern that is used to extract fields from every message in the text.
111
+ The name of the timestamp field in the Grok pattern must match what is specified
112
+ in the `timestamp_field` parameter. If that parameter is not specified, the
113
+ name of the timestamp field in the Grok pattern must match "timestamp". If
114
+ `grok_pattern` is not specified, the structure finder creates a Grok pattern.
115
+ :param quote: If the format is `delimited`, you can specify the character used
116
+ to quote the values in each row if they contain newlines or the delimiter
117
+ character. Only a single character is supported. If this parameter is not
118
+ specified, the default value is a double quote (`"`). If your delimited text
119
+ format does not use quoting, a workaround is to set this argument to a character
120
+ that does not appear anywhere in the sample.
121
+ :param should_trim_fields: If the format is `delimited`, you can specify whether
122
+ values between delimiters should have whitespace trimmed from them. If this
123
+ parameter is not specified and the delimiter is pipe (`|`), the default value
124
+ is true. Otherwise, the default value is `false`.
125
+ :param timeout: The maximum amount of time that the structure analysis can take.
126
+ If the analysis is still running when the timeout expires, it will be stopped.
127
+ :param timestamp_field: The name of the field that contains the primary timestamp
128
+ of each record in the text. In particular, if the text was ingested into
129
+ an index, this is the field that would be used to populate the `@timestamp`
130
+ field. If the format is `semi_structured_text`, this field must match the
131
+ name of the appropriate extraction in the `grok_pattern`. Therefore, for
132
+ semi-structured text, it is best not to specify this parameter unless `grok_pattern`
133
+ is also specified. For structured text, if you specify this parameter, the
134
+ field must exist within the text. If this parameter is not specified, the
135
+ structure finder makes a decision about which field (if any) is the primary
136
+ timestamp field. For structured text, it is not compulsory to have a timestamp
137
+ in the text.
138
+ :param timestamp_format: The Java time format of the timestamp field in the text.
139
+ Only a subset of Java time format letter groups are supported: * `a` * `d`
140
+ * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM`
141
+ * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter
142
+ groups (fractional seconds) of length one to nine are supported providing
143
+ they occur after `ss` and are separated from the `ss` by a period (`.`),
144
+ comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with
145
+ the exception a question mark (`?`), newline, and carriage return, together
146
+ with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS
147
+ 'in' yyyy` is a valid override format. One valuable use case for this parameter
148
+ is when the format is semi-structured text, there are multiple timestamp
149
+ formats in the text, and you know which format corresponds to the primary
150
+ timestamp, but you do not want to specify the full `grok_pattern`. Another
151
+ is when the timestamp format is one that the structure finder does not consider
152
+ by default. If this parameter is not specified, the structure finder chooses
153
+ the best format from a built-in set. If the special value `null` is specified,
154
+ the structure finder will not look for a primary timestamp in the text. When
155
+ the format is semi-structured text, this will result in the structure finder
156
+ treating the text as single-line messages.
157
+ """
158
+ if field is None:
159
+ raise ValueError("Empty value passed for parameter 'field'")
160
+ if index is None:
161
+ raise ValueError("Empty value passed for parameter 'index'")
162
+ __path_parts: t.Dict[str, str] = {}
163
+ __path = "/_text_structure/find_field_structure"
164
+ __query: t.Dict[str, t.Any] = {}
165
+ if field is not None:
166
+ __query["field"] = field
167
+ if index is not None:
168
+ __query["index"] = index
169
+ if column_names is not None:
170
+ __query["column_names"] = column_names
171
+ if delimiter is not None:
172
+ __query["delimiter"] = delimiter
173
+ if documents_to_sample is not None:
174
+ __query["documents_to_sample"] = documents_to_sample
175
+ if ecs_compatibility is not None:
176
+ __query["ecs_compatibility"] = ecs_compatibility
177
+ if error_trace is not None:
178
+ __query["error_trace"] = error_trace
179
+ if explain is not None:
180
+ __query["explain"] = explain
181
+ if filter_path is not None:
182
+ __query["filter_path"] = filter_path
183
+ if format is not None:
184
+ __query["format"] = format
185
+ if grok_pattern is not None:
186
+ __query["grok_pattern"] = grok_pattern
187
+ if human is not None:
188
+ __query["human"] = human
189
+ if pretty is not None:
190
+ __query["pretty"] = pretty
191
+ if quote is not None:
192
+ __query["quote"] = quote
193
+ if should_trim_fields is not None:
194
+ __query["should_trim_fields"] = should_trim_fields
195
+ if timeout is not None:
196
+ __query["timeout"] = timeout
197
+ if timestamp_field is not None:
198
+ __query["timestamp_field"] = timestamp_field
199
+ if timestamp_format is not None:
200
+ __query["timestamp_format"] = timestamp_format
201
+ __headers = {"accept": "application/json"}
202
+ return self.perform_request( # type: ignore[return-value]
203
+ "GET",
204
+ __path,
205
+ params=__query,
206
+ headers=__headers,
207
+ endpoint_id="text_structure.find_field_structure",
208
+ path_parts=__path_parts,
209
+ )
210
+
211
+ @_rewrite_parameters(
212
+ body_fields=("messages",),
213
+ )
214
+ def find_message_structure(
215
+ self,
216
+ *,
217
+ messages: t.Optional[t.Sequence[str]] = None,
218
+ column_names: t.Optional[str] = None,
219
+ delimiter: t.Optional[str] = None,
220
+ ecs_compatibility: t.Optional[t.Union[str, t.Literal["disabled", "v1"]]] = None,
221
+ error_trace: t.Optional[bool] = None,
222
+ explain: t.Optional[bool] = None,
223
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
224
+ format: t.Optional[
225
+ t.Union[
226
+ str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"]
227
+ ]
228
+ ] = None,
229
+ grok_pattern: t.Optional[str] = None,
230
+ human: t.Optional[bool] = None,
231
+ pretty: t.Optional[bool] = None,
232
+ quote: t.Optional[str] = None,
233
+ should_trim_fields: t.Optional[bool] = None,
234
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
235
+ timestamp_field: t.Optional[str] = None,
236
+ timestamp_format: t.Optional[str] = None,
237
+ body: t.Optional[t.Dict[str, t.Any]] = None,
238
+ ) -> ObjectApiResponse[t.Any]:
239
+ """
240
+ Find the structure of text messages. Find the structure of a list of text messages.
241
+ The messages must contain data that is suitable to be ingested into Elasticsearch.
242
+ This API provides a starting point for ingesting data into Elasticsearch in a
243
+ format that is suitable for subsequent use with other Elastic Stack functionality.
244
+ Use this API rather than the find text structure API if your input text has already
245
+ been split up into separate messages by some other process. The response from
246
+ the API contains: * Sample messages. * Statistics that reveal the most common
247
+ values for all fields detected within the text and basic numeric statistics for
248
+ numeric fields. * Information about the structure of the text, which is useful
249
+ when you write ingest configurations to index it or similarly formatted text.
250
+ Appropriate mappings for an Elasticsearch index, which you could use to ingest
251
+ the text. All this information can be calculated by the structure finder with
252
+ no guidance. However, you can optionally override some of the decisions about
253
+ the text structure by specifying one or more query parameters. If the structure
254
+ finder produces unexpected results, specify the `explain` query parameter and
255
+ an explanation will appear in the response. It helps determine why the returned
256
+ structure was chosen.
257
+
258
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/find-message-structure.html>`_
259
+
260
+ :param messages: The list of messages you want to analyze.
261
+ :param column_names: If the format is `delimited`, you can specify the column
262
+ names in a comma-separated list. If this parameter is not specified, the
263
+ structure finder uses the column names from the header row of the text. If
264
+ the text does not have a header role, columns are named "column1", "column2",
265
+ "column3", for example.
266
+ :param delimiter: If you the format is `delimited`, you can specify the character
267
+ used to delimit the values in each row. Only a single character is supported;
268
+ the delimiter cannot have multiple characters. By default, the API considers
269
+ the following possibilities: comma, tab, semi-colon, and pipe (`|`). In this
270
+ default scenario, all rows must have the same number of fields for the delimited
271
+ format to be detected. If you specify a delimiter, up to 10% of the rows
272
+ can have a different number of columns than the first row.
273
+ :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns.
274
+ Use this parameter to specify whether to use ECS Grok patterns instead of
275
+ legacy ones when the structure finder creates a Grok pattern. This setting
276
+ primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}`
277
+ matches the input. If the structure finder identifies a common structure
278
+ but has no idea of meaning then generic field names such as `path`, `ipaddress`,
279
+ `field1`, and `field2` are used in the `grok_pattern` output, with the intention
280
+ that a user who knows the meanings rename these fields before using it.
281
+ :param explain: If this parameter is set to true, the response includes a field
282
+ named `explanation`, which is an array of strings that indicate how the structure
283
+ finder produced its result.
284
+ :param format: The high level structure of the text. By default, the API chooses
285
+ the format. In this default scenario, all rows must have the same number
286
+ of fields for a delimited format to be detected. If the format is `delimited`
287
+ and the delimiter is not set, however, the API tolerates up to 5% of rows
288
+ that have a different number of columns than the first row.
289
+ :param grok_pattern: If the format is `semi_structured_text`, you can specify
290
+ a Grok pattern that is used to extract fields from every message in the text.
291
+ The name of the timestamp field in the Grok pattern must match what is specified
292
+ in the `timestamp_field` parameter. If that parameter is not specified, the
293
+ name of the timestamp field in the Grok pattern must match "timestamp". If
294
+ `grok_pattern` is not specified, the structure finder creates a Grok pattern.
295
+ :param quote: If the format is `delimited`, you can specify the character used
296
+ to quote the values in each row if they contain newlines or the delimiter
297
+ character. Only a single character is supported. If this parameter is not
298
+ specified, the default value is a double quote (`"`). If your delimited text
299
+ format does not use quoting, a workaround is to set this argument to a character
300
+ that does not appear anywhere in the sample.
301
+ :param should_trim_fields: If the format is `delimited`, you can specify whether
302
+ values between delimiters should have whitespace trimmed from them. If this
303
+ parameter is not specified and the delimiter is pipe (`|`), the default value
304
+ is true. Otherwise, the default value is `false`.
305
+ :param timeout: The maximum amount of time that the structure analysis can take.
306
+ If the analysis is still running when the timeout expires, it will be stopped.
307
+ :param timestamp_field: The name of the field that contains the primary timestamp
308
+ of each record in the text. In particular, if the text was ingested into
309
+ an index, this is the field that would be used to populate the `@timestamp`
310
+ field. If the format is `semi_structured_text`, this field must match the
311
+ name of the appropriate extraction in the `grok_pattern`. Therefore, for
312
+ semi-structured text, it is best not to specify this parameter unless `grok_pattern`
313
+ is also specified. For structured text, if you specify this parameter, the
314
+ field must exist within the text. If this parameter is not specified, the
315
+ structure finder makes a decision about which field (if any) is the primary
316
+ timestamp field. For structured text, it is not compulsory to have a timestamp
317
+ in the text.
318
+ :param timestamp_format: The Java time format of the timestamp field in the text.
319
+ Only a subset of Java time format letter groups are supported: * `a` * `d`
320
+ * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM`
321
+ * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter
322
+ groups (fractional seconds) of length one to nine are supported providing
323
+ they occur after `ss` and are separated from the `ss` by a period (`.`),
324
+ comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with
325
+ the exception a question mark (`?`), newline, and carriage return, together
326
+ with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS
327
+ 'in' yyyy` is a valid override format. One valuable use case for this parameter
328
+ is when the format is semi-structured text, there are multiple timestamp
329
+ formats in the text, and you know which format corresponds to the primary
330
+ timestamp, but you do not want to specify the full `grok_pattern`. Another
331
+ is when the timestamp format is one that the structure finder does not consider
332
+ by default. If this parameter is not specified, the structure finder chooses
333
+ the best format from a built-in set. If the special value `null` is specified,
334
+ the structure finder will not look for a primary timestamp in the text. When
335
+ the format is semi-structured text, this will result in the structure finder
336
+ treating the text as single-line messages.
337
+ """
338
+ if messages is None and body is None:
339
+ raise ValueError("Empty value passed for parameter 'messages'")
340
+ __path_parts: t.Dict[str, str] = {}
341
+ __path = "/_text_structure/find_message_structure"
342
+ __query: t.Dict[str, t.Any] = {}
343
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
344
+ if column_names is not None:
345
+ __query["column_names"] = column_names
346
+ if delimiter is not None:
347
+ __query["delimiter"] = delimiter
348
+ if ecs_compatibility is not None:
349
+ __query["ecs_compatibility"] = ecs_compatibility
350
+ if error_trace is not None:
351
+ __query["error_trace"] = error_trace
352
+ if explain is not None:
353
+ __query["explain"] = explain
354
+ if filter_path is not None:
355
+ __query["filter_path"] = filter_path
356
+ if format is not None:
357
+ __query["format"] = format
358
+ if grok_pattern is not None:
359
+ __query["grok_pattern"] = grok_pattern
360
+ if human is not None:
361
+ __query["human"] = human
362
+ if pretty is not None:
363
+ __query["pretty"] = pretty
364
+ if quote is not None:
365
+ __query["quote"] = quote
366
+ if should_trim_fields is not None:
367
+ __query["should_trim_fields"] = should_trim_fields
368
+ if timeout is not None:
369
+ __query["timeout"] = timeout
370
+ if timestamp_field is not None:
371
+ __query["timestamp_field"] = timestamp_field
372
+ if timestamp_format is not None:
373
+ __query["timestamp_format"] = timestamp_format
374
+ if not __body:
375
+ if messages is not None:
376
+ __body["messages"] = messages
377
+ __headers = {"accept": "application/json", "content-type": "application/json"}
378
+ return self.perform_request( # type: ignore[return-value]
379
+ "POST",
380
+ __path,
381
+ params=__query,
382
+ headers=__headers,
383
+ body=__body,
384
+ endpoint_id="text_structure.find_message_structure",
385
+ path_parts=__path_parts,
386
+ )
387
+
28
388
  @_rewrite_parameters(
29
389
  body_name="text_files",
30
390
  )
@@ -50,47 +410,71 @@ class TextStructureClient(NamespacedClient):
50
410
  timestamp_format: t.Optional[str] = None,
51
411
  ) -> ObjectApiResponse[t.Any]:
52
412
  """
53
- Finds the structure of a text file. The text file must contain data that is suitable
54
- to be ingested into Elasticsearch.
413
+ Find the structure of a text file. The text file must contain data that is suitable
414
+ to be ingested into Elasticsearch. This API provides a starting point for ingesting
415
+ data into Elasticsearch in a format that is suitable for subsequent use with
416
+ other Elastic Stack functionality. Unlike other Elasticsearch endpoints, the
417
+ data that is posted to this endpoint does not need to be UTF-8 encoded and in
418
+ JSON format. It must, however, be text; binary text formats are not currently
419
+ supported. The size is limited to the Elasticsearch HTTP receive buffer size,
420
+ which defaults to 100 Mb. The response from the API contains: * A couple of messages
421
+ from the beginning of the text. * Statistics that reveal the most common values
422
+ for all fields detected within the text and basic numeric statistics for numeric
423
+ fields. * Information about the structure of the text, which is useful when you
424
+ write ingest configurations to index it or similarly formatted text. * Appropriate
425
+ mappings for an Elasticsearch index, which you could use to ingest the text.
426
+ All this information can be calculated by the structure finder with no guidance.
427
+ However, you can optionally override some of the decisions about the text structure
428
+ by specifying one or more query parameters.
55
429
 
56
430
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/find-structure.html>`_
57
431
 
58
432
  :param text_files:
59
- :param charset: The texts character set. It must be a character set that is
60
- supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE,
61
- windows-1252, or EUC-JP. If this parameter is not specified, the structure
433
+ :param charset: The text's character set. It must be a character set that is
434
+ supported by the JVM that Elasticsearch uses. For example, `UTF-8`, `UTF-16LE`,
435
+ `windows-1252`, or `EUC-JP`. If this parameter is not specified, the structure
62
436
  finder chooses an appropriate character set.
63
- :param column_names: If you have set format to delimited, you can specify the
437
+ :param column_names: If you have set format to `delimited`, you can specify the
64
438
  column names in a comma-separated list. If this parameter is not specified,
65
439
  the structure finder uses the column names from the header row of the text.
66
440
  If the text does not have a header role, columns are named "column1", "column2",
67
- "column3", etc.
68
- :param delimiter: If you have set format to delimited, you can specify the character
69
- used to delimit the values in each row. Only a single character is supported;
70
- the delimiter cannot have multiple characters. By default, the API considers
71
- the following possibilities: comma, tab, semi-colon, and pipe (|). In this
72
- default scenario, all rows must have the same number of fields for the delimited
73
- format to be detected. If you specify a delimiter, up to 10% of the rows
74
- can have a different number of columns than the first row.
75
- :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns
76
- (disabled or v1, default: disabled).
77
- :param explain: If this parameter is set to true, the response includes a field
441
+ "column3", for example.
442
+ :param delimiter: If you have set `format` to `delimited`, you can specify the
443
+ character used to delimit the values in each row. Only a single character
444
+ is supported; the delimiter cannot have multiple characters. By default,
445
+ the API considers the following possibilities: comma, tab, semi-colon, and
446
+ pipe (`|`). In this default scenario, all rows must have the same number
447
+ of fields for the delimited format to be detected. If you specify a delimiter,
448
+ up to 10% of the rows can have a different number of columns than the first
449
+ row.
450
+ :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns.
451
+ Use this parameter to specify whether to use ECS Grok patterns instead of
452
+ legacy ones when the structure finder creates a Grok pattern. Valid values
453
+ are `disabled` and `v1`. This setting primarily has an impact when a whole
454
+ message Grok pattern such as `%{CATALINALOG}` matches the input. If the structure
455
+ finder identifies a common structure but has no idea of meaning then generic
456
+ field names such as `path`, `ipaddress`, `field1`, and `field2` are used
457
+ in the `grok_pattern` output, with the intention that a user who knows the
458
+ meanings rename these fields before using it.
459
+ :param explain: If this parameter is set to `true`, the response includes a field
78
460
  named explanation, which is an array of strings that indicate how the structure
79
- finder produced its result.
80
- :param format: The high level structure of the text. Valid values are ndjson,
81
- xml, delimited, and semi_structured_text. By default, the API chooses the
82
- format. In this default scenario, all rows must have the same number of fields
83
- for a delimited format to be detected. If the format is set to delimited
84
- and the delimiter is not set, however, the API tolerates up to 5% of rows
85
- that have a different number of columns than the first row.
86
- :param grok_pattern: If you have set format to semi_structured_text, you can
87
- specify a Grok pattern that is used to extract fields from every message
461
+ finder produced its result. If the structure finder produces unexpected results
462
+ for some text, use this query parameter to help you determine why the returned
463
+ structure was chosen.
464
+ :param format: The high level structure of the text. Valid values are `ndjson`,
465
+ `xml`, `delimited`, and `semi_structured_text`. By default, the API chooses
466
+ the format. In this default scenario, all rows must have the same number
467
+ of fields for a delimited format to be detected. If the format is set to
468
+ `delimited` and the delimiter is not set, however, the API tolerates up to
469
+ 5% of rows that have a different number of columns than the first row.
470
+ :param grok_pattern: If you have set `format` to `semi_structured_text`, you
471
+ can specify a Grok pattern that is used to extract fields from every message
88
472
  in the text. The name of the timestamp field in the Grok pattern must match
89
- what is specified in the timestamp_field parameter. If that parameter is
473
+ what is specified in the `timestamp_field` parameter. If that parameter is
90
474
  not specified, the name of the timestamp field in the Grok pattern must match
91
- "timestamp". If grok_pattern is not specified, the structure finder creates
475
+ "timestamp". If `grok_pattern` is not specified, the structure finder creates
92
476
  a Grok pattern.
93
- :param has_header_row: If you have set format to delimited, you can use this
477
+ :param has_header_row: If you have set `format` to `delimited`, you can use this
94
478
  parameter to indicate whether the column names are in the first row of the
95
479
  text. If this parameter is not specified, the structure finder guesses based
96
480
  on the similarity of the first row of the text to other rows.
@@ -100,26 +484,58 @@ class TextStructureClient(NamespacedClient):
100
484
  that this may lead to very long processing times if the way to group lines
101
485
  into messages is misdetected.
102
486
  :param lines_to_sample: The number of lines to include in the structural analysis,
103
- starting from the beginning of the text. The minimum is 2; If the value of
487
+ starting from the beginning of the text. The minimum is 2. If the value of
104
488
  this parameter is greater than the number of lines in the text, the analysis
105
489
  proceeds (as long as there are at least two lines in the text) for all of
106
- the lines.
107
- :param quote: If you have set format to delimited, you can specify the character
490
+ the lines. NOTE: The number of lines and the variation of the lines affects
491
+ the speed of the analysis. For example, if you upload text where the first
492
+ 1000 lines are all variations on the same message, the analysis will find
493
+ more commonality than would be seen with a bigger sample. If possible, however,
494
+ it is more efficient to upload sample text with more variety in the first
495
+ 1000 lines than to request analysis of 100000 lines to achieve some variety.
496
+ :param quote: If you have set `format` to `delimited`, you can specify the character
108
497
  used to quote the values in each row if they contain newlines or the delimiter
109
498
  character. Only a single character is supported. If this parameter is not
110
- specified, the default value is a double quote ("). If your delimited text
499
+ specified, the default value is a double quote (`"`). If your delimited text
111
500
  format does not use quoting, a workaround is to set this argument to a character
112
501
  that does not appear anywhere in the sample.
113
- :param should_trim_fields: If you have set format to delimited, you can specify
502
+ :param should_trim_fields: If you have set `format` to `delimited`, you can specify
114
503
  whether values between delimiters should have whitespace trimmed from them.
115
- If this parameter is not specified and the delimiter is pipe (|), the default
116
- value is true. Otherwise, the default value is false.
117
- :param timeout: Sets the maximum amount of time that the structure analysis make
118
- take. If the analysis is still running when the timeout expires then it will
119
- be aborted.
120
- :param timestamp_field: Optional parameter to specify the timestamp field in
121
- the file
504
+ If this parameter is not specified and the delimiter is pipe (`|`), the default
505
+ value is `true`. Otherwise, the default value is `false`.
506
+ :param timeout: The maximum amount of time that the structure analysis can take.
507
+ If the analysis is still running when the timeout expires then it will be
508
+ stopped.
509
+ :param timestamp_field: The name of the field that contains the primary timestamp
510
+ of each record in the text. In particular, if the text were ingested into
511
+ an index, this is the field that would be used to populate the `@timestamp`
512
+ field. If the `format` is `semi_structured_text`, this field must match the
513
+ name of the appropriate extraction in the `grok_pattern`. Therefore, for
514
+ semi-structured text, it is best not to specify this parameter unless `grok_pattern`
515
+ is also specified. For structured text, if you specify this parameter, the
516
+ field must exist within the text. If this parameter is not specified, the
517
+ structure finder makes a decision about which field (if any) is the primary
518
+ timestamp field. For structured text, it is not compulsory to have a timestamp
519
+ in the text.
122
520
  :param timestamp_format: The Java time format of the timestamp field in the text.
521
+ Only a subset of Java time format letter groups are supported: * `a` * `d`
522
+ * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM`
523
+ * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter
524
+ groups (fractional seconds) of length one to nine are supported providing
525
+ they occur after `ss` and separated from the `ss` by a `.`, `,` or `:`. Spacing
526
+ and punctuation is also permitted with the exception of `?`, newline and
527
+ carriage return, together with literal text enclosed in single quotes. For
528
+ example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. One
529
+ valuable use case for this parameter is when the format is semi-structured
530
+ text, there are multiple timestamp formats in the text, and you know which
531
+ format corresponds to the primary timestamp, but you do not want to specify
532
+ the full `grok_pattern`. Another is when the timestamp format is one that
533
+ the structure finder does not consider by default. If this parameter is not
534
+ specified, the structure finder chooses the best format from a built-in set.
535
+ If the special value `null` is specified the structure finder will not look
536
+ for a primary timestamp in the text. When the format is semi-structured text
537
+ this will result in the structure finder treating the text as single-line
538
+ messages.
123
539
  """
124
540
  if text_files is None and body is None:
125
541
  raise ValueError(
@@ -191,14 +607,18 @@ class TextStructureClient(NamespacedClient):
191
607
  body: t.Optional[t.Dict[str, t.Any]] = None,
192
608
  ) -> ObjectApiResponse[t.Any]:
193
609
  """
194
- Tests a Grok pattern on some text.
610
+ Test a Grok pattern. Test a Grok pattern on one or more lines of text. The API
611
+ indicates whether the lines match the pattern together with the offsets and lengths
612
+ of the matched substrings.
195
613
 
196
614
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/test-grok-pattern.html>`_
197
615
 
198
- :param grok_pattern: Grok pattern to run on the text.
199
- :param text: Lines of text to run the Grok pattern on.
200
- :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns
201
- (disabled or v1, default: disabled).
616
+ :param grok_pattern: The Grok pattern to run on the text.
617
+ :param text: The lines of text to run the Grok pattern on.
618
+ :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns.
619
+ Use this parameter to specify whether to use ECS Grok patterns instead of
620
+ legacy ones when the structure finder creates a Grok pattern. Valid values
621
+ are `disabled` and `v1`.
202
622
  """
203
623
  if grok_pattern is None and body is None:
204
624
  raise ValueError("Empty value passed for parameter 'grok_pattern'")
@@ -844,13 +844,20 @@ class TransformClient(NamespacedClient):
844
844
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
845
845
  ) -> ObjectApiResponse[t.Any]:
846
846
  """
847
- Upgrades all transforms. This API identifies transforms that have a legacy configuration
847
+ Upgrade all transforms. Transforms are compatible across minor versions and between
848
+ supported major versions. However, over time, the format of transform configuration
849
+ information may change. This API identifies transforms that have a legacy configuration
848
850
  format and upgrades them to the latest version. It also cleans up the internal
849
851
  data structures that store the transform state and checkpoints. The upgrade does
850
852
  not affect the source and destination indices. The upgrade also does not affect
851
853
  the roles that transforms use when Elasticsearch security features are enabled;
852
854
  the role used to read source data and write to the destination index remains
853
- unchanged.
855
+ unchanged. If a transform upgrade step fails, the upgrade stops and an error
856
+ is returned about the underlying issue. Resolve the issue then re-run the process
857
+ again. A summary is returned when the upgrade is finished. To ensure continuous
858
+ transforms remain running during a major version upgrade of the cluster – for
859
+ example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading
860
+ the cluster. You may want to perform a recent cluster backup prior to the upgrade.
854
861
 
855
862
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/upgrade-transforms.html>`_
856
863