Skip to content

Commit

Permalink
Update APIs for 7.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Apr 20, 2021
1 parent 0c93aaf commit 76f8f85
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 14 deletions.
5 changes: 3 additions & 2 deletions elasticsearch/_async/client/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ class FeaturesClient(NamespacedClient):
@query_params("master_timeout")
async def get_features(self, params=None, headers=None):
"""
Returns a list of features which can be snapshotted in this cluster.
Gets a list of features which can be included in snapshots using the
feature_states field when creating a snapshot
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/modules-snapshots.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/get-features-api.html>`_
:arg master_timeout: Explicit operation timeout for connection
to master node
Expand Down
73 changes: 73 additions & 0 deletions elasticsearch/_async/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,3 +1676,76 @@ async def upgrade_job_snapshot(
params=params,
headers=headers,
)

@query_params(
"charset",
"column_names",
"delimiter",
"explain",
"format",
"grok_pattern",
"has_header_row",
"line_merge_size_limit",
"lines_to_sample",
"quote",
"should_trim_fields",
"timeout",
"timestamp_field",
"timestamp_format",
)
async def find_file_structure(self, body, params=None, headers=None):
"""
Finds the structure of a text file. The text file must contain data that is
suitable to be ingested into Elasticsearch.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/find-structure.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The contents of the file to be analyzed
:arg charset: Optional parameter to specify the character set of
the file
:arg column_names: Optional parameter containing a comma
separated list of the column names for a delimited file
:arg delimiter: Optional parameter to specify the delimiter
character for a delimited file - must be a single character
:arg explain: Whether to include a commentary on how the
structure was derived
:arg format: Optional parameter to specify the high level file
format Valid choices: ndjson, xml, delimited, semi_structured_text
:arg grok_pattern: Optional parameter to specify the Grok
pattern that should be used to extract fields from messages in a semi-
structured text file
:arg has_header_row: Optional parameter to specify whether a
delimited file includes the column names in its first row
:arg line_merge_size_limit: Maximum number of characters
permitted in a single message when lines are merged to create messages.
Default: 10000
:arg lines_to_sample: How many lines of the file should be
included in the analysis Default: 1000
:arg quote: Optional parameter to specify the quote character
for a delimited file - must be a single character
:arg should_trim_fields: Optional parameter to specify whether
the values between delimiters in a delimited file should have whitespace
trimmed from them
:arg timeout: Timeout after which the analysis will be aborted
Default: 25s
:arg timestamp_field: Optional parameter to specify the
timestamp field in the file
:arg timestamp_format: Optional parameter to specify the
timestamp format in the file - may be either a Joda or Java time format
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")

body = _bulk_body(self.transport.serializer, body)
return await self.transport.perform_request(
"POST",
"/_ml/find_file_structure",
params=params,
headers=headers,
body=body,
)
28 changes: 28 additions & 0 deletions elasticsearch/_async/client/ml.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1085,3 +1085,31 @@ class MlClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
async def find_file_structure(
self,
*,
body: Any,
charset: Optional[Any] = ...,
column_names: Optional[Any] = ...,
delimiter: Optional[Any] = ...,
explain: Optional[Any] = ...,
format: Optional[Any] = ...,
grok_pattern: Optional[Any] = ...,
has_header_row: Optional[Any] = ...,
line_merge_size_limit: Optional[Any] = ...,
lines_to_sample: Optional[Any] = ...,
quote: Optional[Any] = ...,
should_trim_fields: Optional[Any] = ...,
timeout: Optional[Any] = ...,
timestamp_field: Optional[Any] = ...,
timestamp_format: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
5 changes: 0 additions & 5 deletions elasticsearch/_async/client/text_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ async def find_structure(self, body, params=None, headers=None):
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/find-structure.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The contents of the file to be analyzed
:arg charset: Optional parameter to specify the character set of
the file
Expand Down
5 changes: 3 additions & 2 deletions elasticsearch/client/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ class FeaturesClient(NamespacedClient):
@query_params("master_timeout")
def get_features(self, params=None, headers=None):
"""
Returns a list of features which can be snapshotted in this cluster.
Gets a list of features which can be included in snapshots using the
feature_states field when creating a snapshot
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/modules-snapshots.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/get-features-api.html>`_
:arg master_timeout: Explicit operation timeout for connection
to master node
Expand Down
73 changes: 73 additions & 0 deletions elasticsearch/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1660,3 +1660,76 @@ def upgrade_job_snapshot(self, job_id, snapshot_id, params=None, headers=None):
params=params,
headers=headers,
)

@query_params(
"charset",
"column_names",
"delimiter",
"explain",
"format",
"grok_pattern",
"has_header_row",
"line_merge_size_limit",
"lines_to_sample",
"quote",
"should_trim_fields",
"timeout",
"timestamp_field",
"timestamp_format",
)
def find_file_structure(self, body, params=None, headers=None):
"""
Finds the structure of a text file. The text file must contain data that is
suitable to be ingested into Elasticsearch.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/find-structure.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The contents of the file to be analyzed
:arg charset: Optional parameter to specify the character set of
the file
:arg column_names: Optional parameter containing a comma
separated list of the column names for a delimited file
:arg delimiter: Optional parameter to specify the delimiter
character for a delimited file - must be a single character
:arg explain: Whether to include a commentary on how the
structure was derived
:arg format: Optional parameter to specify the high level file
format Valid choices: ndjson, xml, delimited, semi_structured_text
:arg grok_pattern: Optional parameter to specify the Grok
pattern that should be used to extract fields from messages in a semi-
structured text file
:arg has_header_row: Optional parameter to specify whether a
delimited file includes the column names in its first row
:arg line_merge_size_limit: Maximum number of characters
permitted in a single message when lines are merged to create messages.
Default: 10000
:arg lines_to_sample: How many lines of the file should be
included in the analysis Default: 1000
:arg quote: Optional parameter to specify the quote character
for a delimited file - must be a single character
:arg should_trim_fields: Optional parameter to specify whether
the values between delimiters in a delimited file should have whitespace
trimmed from them
:arg timeout: Timeout after which the analysis will be aborted
Default: 25s
:arg timestamp_field: Optional parameter to specify the
timestamp field in the file
:arg timestamp_format: Optional parameter to specify the
timestamp format in the file - may be either a Joda or Java time format
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")

body = _bulk_body(self.transport.serializer, body)
return self.transport.perform_request(
"POST",
"/_ml/find_file_structure",
params=params,
headers=headers,
body=body,
)
28 changes: 28 additions & 0 deletions elasticsearch/client/ml.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1085,3 +1085,31 @@ class MlClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
def find_file_structure(
self,
*,
body: Any,
charset: Optional[Any] = ...,
column_names: Optional[Any] = ...,
delimiter: Optional[Any] = ...,
explain: Optional[Any] = ...,
format: Optional[Any] = ...,
grok_pattern: Optional[Any] = ...,
has_header_row: Optional[Any] = ...,
line_merge_size_limit: Optional[Any] = ...,
lines_to_sample: Optional[Any] = ...,
quote: Optional[Any] = ...,
should_trim_fields: Optional[Any] = ...,
timeout: Optional[Any] = ...,
timestamp_field: Optional[Any] = ...,
timestamp_format: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...
) -> Any: ...
5 changes: 0 additions & 5 deletions elasticsearch/client/text_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ def find_structure(self, body, params=None, headers=None):
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.12/find-structure.html>`_
.. warning::
This API is **experimental** so may include breaking changes
or be removed in a future version
:arg body: The contents of the file to be analyzed
:arg charset: Optional parameter to specify the character set of
the file
Expand Down

0 comments on commit 76f8f85

Please sign in to comment.