Skip to content

Commit 24524fa

Browse files
authored
Make 'body' optional on 'indices.create_data_stream' API
1 parent 6df172d commit 24524fa

File tree

10 files changed

+30
-18
lines changed

10 files changed

+30
-18
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,8 @@ async def search(self, body=None, index=None, params=None, headers=None):
14321432
:arg track_scores: Whether to calculate and return scores even
14331433
if they are not used for sorting
14341434
:arg track_total_hits: Indicate if the number of documents that
1435-
match the query should be tracked
1435+
match the query should be tracked. A number can also be specified, to
1436+
accurately track the total hit count up to the number.
14361437
:arg typed_keys: Specify whether aggregation and suggester names
14371438
should be prefixed by their respective types in the response
14381439
:arg version: Specify whether to return document version as part

elasticsearch/_async/client/indices.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,17 +1203,16 @@ async def validate_query(
12031203
)
12041204

12051205
@query_params()
1206-
async def create_data_stream(self, name, body, params=None, headers=None):
1206+
async def create_data_stream(self, name, body=None, params=None, headers=None):
12071207
"""
12081208
Creates or updates a data stream
12091209
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html>`_
12101210
12111211
:arg name: The name of the data stream
12121212
:arg body: The data stream definition
12131213
"""
1214-
for param in (name, body):
1215-
if param in SKIP_IN_PATH:
1216-
raise ValueError("Empty value passed for a required argument.")
1214+
if name in SKIP_IN_PATH:
1215+
raise ValueError("Empty value passed for a required argument 'name'.")
12171216

12181217
return await self.transport.perform_request(
12191218
"PUT",

elasticsearch/_async/client/ml.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ async def flush_job(self, job_id, body=None, params=None, headers=None):
318318
body=body,
319319
)
320320

321-
@query_params("duration", "expires_in")
321+
@query_params("duration", "expires_in", "max_model_memory")
322322
async def forecast(self, job_id, params=None, headers=None):
323323
"""
324324
Predicts the future behavior of a time series by using its historical behavior.
@@ -328,6 +328,8 @@ async def forecast(self, job_id, params=None, headers=None):
328328
:arg duration: The duration of the forecast
329329
:arg expires_in: The time interval after which the forecast
330330
expires. Expired forecasts will be deleted at the first opportunity.
331+
:arg max_model_memory: The max memory able to be used by the
332+
forecast. Default is 20mb.
331333
"""
332334
if job_id in SKIP_IN_PATH:
333335
raise ValueError("Empty value passed for a required argument 'job_id'.")
@@ -1244,6 +1246,7 @@ async def delete_trained_model(self, model_id, params=None, headers=None):
12441246
@query_params(
12451247
"allow_no_match",
12461248
"decompress_definition",
1249+
"for_export",
12471250
"from_",
12481251
"include_model_definition",
12491252
"size",
@@ -1261,6 +1264,8 @@ async def get_trained_models(self, model_id=None, params=None, headers=None):
12611264
:arg decompress_definition: Should the model definition be
12621265
decompressed into valid JSON or returned in a custom compressed format.
12631266
Defaults to true. Default: True
1267+
:arg for_export: Omits fields that are illegal to set on model
1268+
PUT
12641269
:arg from\\_: skips a number of trained models
12651270
:arg include_model_definition: Should the full model definition
12661271
be included in the results. These definitions can be large. So be

elasticsearch/_async/client/security.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ async def get_role(self, name=None, params=None, headers=None):
277277
Retrieves roles in the native realm.
278278
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role.html>`_
279279
280-
:arg name: Role name
280+
:arg name: A comma-separated list of role names
281281
"""
282282
return await self.transport.perform_request(
283283
"GET", _make_path("_security", "role", name), params=params, headers=headers
@@ -289,7 +289,7 @@ async def get_role_mapping(self, name=None, params=None, headers=None):
289289
Retrieves role mappings.
290290
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role-mapping.html>`_
291291
292-
:arg name: Role-Mapping name
292+
:arg name: A comma-separated list of role-mapping names
293293
"""
294294
return await self.transport.perform_request(
295295
"GET",

elasticsearch/_async/client/snapshot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ async def delete_repository(self, repository, params=None, headers=None):
8787
Deletes a repository.
8888
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
8989
90-
:arg repository: A comma-separated list of repository names
90+
:arg repository: Name of the snapshot repository to unregister.
91+
Wildcard (`*`) patterns are supported.
9192
:arg master_timeout: Explicit operation timeout for connection
9293
to master node
9394
:arg timeout: Explicit operation timeout

elasticsearch/client/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,8 @@ def search(self, body=None, index=None, params=None, headers=None):
14301430
:arg track_scores: Whether to calculate and return scores even
14311431
if they are not used for sorting
14321432
:arg track_total_hits: Indicate if the number of documents that
1433-
match the query should be tracked
1433+
match the query should be tracked. A number can also be specified, to
1434+
accurately track the total hit count up to the number.
14341435
:arg typed_keys: Specify whether aggregation and suggester names
14351436
should be prefixed by their respective types in the response
14361437
:arg version: Specify whether to return document version as part

elasticsearch/client/indices.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,17 +1201,16 @@ def validate_query(
12011201
)
12021202

12031203
@query_params()
1204-
def create_data_stream(self, name, body, params=None, headers=None):
1204+
def create_data_stream(self, name, body=None, params=None, headers=None):
12051205
"""
12061206
Creates or updates a data stream
12071207
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html>`_
12081208
12091209
:arg name: The name of the data stream
12101210
:arg body: The data stream definition
12111211
"""
1212-
for param in (name, body):
1213-
if param in SKIP_IN_PATH:
1214-
raise ValueError("Empty value passed for a required argument.")
1212+
if name in SKIP_IN_PATH:
1213+
raise ValueError("Empty value passed for a required argument 'name'.")
12151214

12161215
return self.transport.perform_request(
12171216
"PUT",

elasticsearch/client/ml.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def flush_job(self, job_id, body=None, params=None, headers=None):
312312
body=body,
313313
)
314314

315-
@query_params("duration", "expires_in")
315+
@query_params("duration", "expires_in", "max_model_memory")
316316
def forecast(self, job_id, params=None, headers=None):
317317
"""
318318
Predicts the future behavior of a time series by using its historical behavior.
@@ -322,6 +322,8 @@ def forecast(self, job_id, params=None, headers=None):
322322
:arg duration: The duration of the forecast
323323
:arg expires_in: The time interval after which the forecast
324324
expires. Expired forecasts will be deleted at the first opportunity.
325+
:arg max_model_memory: The max memory able to be used by the
326+
forecast. Default is 20mb.
325327
"""
326328
if job_id in SKIP_IN_PATH:
327329
raise ValueError("Empty value passed for a required argument 'job_id'.")
@@ -1232,6 +1234,7 @@ def delete_trained_model(self, model_id, params=None, headers=None):
12321234
@query_params(
12331235
"allow_no_match",
12341236
"decompress_definition",
1237+
"for_export",
12351238
"from_",
12361239
"include_model_definition",
12371240
"size",
@@ -1249,6 +1252,8 @@ def get_trained_models(self, model_id=None, params=None, headers=None):
12491252
:arg decompress_definition: Should the model definition be
12501253
decompressed into valid JSON or returned in a custom compressed format.
12511254
Defaults to true. Default: True
1255+
:arg for_export: Omits fields that are illegal to set on model
1256+
PUT
12521257
:arg from\\_: skips a number of trained models
12531258
:arg include_model_definition: Should the full model definition
12541259
be included in the results. These definitions can be large. So be

elasticsearch/client/security.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def get_role(self, name=None, params=None, headers=None):
275275
Retrieves roles in the native realm.
276276
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role.html>`_
277277
278-
:arg name: Role name
278+
:arg name: A comma-separated list of role names
279279
"""
280280
return self.transport.perform_request(
281281
"GET", _make_path("_security", "role", name), params=params, headers=headers
@@ -287,7 +287,7 @@ def get_role_mapping(self, name=None, params=None, headers=None):
287287
Retrieves role mappings.
288288
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role-mapping.html>`_
289289
290-
:arg name: Role-Mapping name
290+
:arg name: A comma-separated list of role-mapping names
291291
"""
292292
return self.transport.perform_request(
293293
"GET",

elasticsearch/client/snapshot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def delete_repository(self, repository, params=None, headers=None):
8787
Deletes a repository.
8888
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
8989
90-
:arg repository: A comma-separated list of repository names
90+
:arg repository: Name of the snapshot repository to unregister.
91+
Wildcard (`*`) patterns are supported.
9192
:arg master_timeout: Explicit operation timeout for connection
9293
to master node
9394
:arg timeout: Explicit operation timeout

0 commit comments

Comments
 (0)