Skip to content

Commit 3264ba6

Browse files
Auto-generated code for main (#2475)
Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
1 parent 8a19bb9 commit 3264ba6

File tree

4 files changed

+76
-26
lines changed

4 files changed

+76
-26
lines changed

elasticsearch/_async/client/inference.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,14 @@ async def put_model(
214214
self,
215215
*,
216216
inference_id: str,
217+
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
218+
body: t.Optional[t.Mapping[str, t.Any]] = None,
217219
task_type: t.Optional[
218220
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
219221
] = None,
220222
error_trace: t.Optional[bool] = None,
221223
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
222224
human: t.Optional[bool] = None,
223-
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
224-
body: t.Optional[t.Mapping[str, t.Any]] = None,
225225
pretty: t.Optional[bool] = None,
226226
) -> ObjectApiResponse[t.Any]:
227227
"""
@@ -230,8 +230,8 @@ async def put_model(
230230
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html>`_
231231
232232
:param inference_id: The inference Id
233-
:param task_type: The task type
234233
:param model_config:
234+
:param task_type: The task type
235235
"""
236236
if inference_id in SKIP_IN_PATH:
237237
raise ValueError("Empty value passed for parameter 'inference_id'")
@@ -263,11 +263,7 @@ async def put_model(
263263
if pretty is not None:
264264
__query["pretty"] = pretty
265265
__body = model_config if model_config is not None else body
266-
if not __body:
267-
__body = None
268-
__headers = {"accept": "application/json"}
269-
if __body is not None:
270-
__headers["content-type"] = "application/json"
266+
__headers = {"accept": "application/json", "content-type": "application/json"}
271267
return await self.perform_request( # type: ignore[return-value]
272268
"PUT",
273269
__path,

elasticsearch/_async/client/security.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,12 +2343,22 @@ async def put_user(
23432343
)
23442344

23452345
@_rewrite_parameters(
2346-
body_fields=("from_", "query", "search_after", "size", "sort"),
2346+
body_fields=(
2347+
"aggregations",
2348+
"aggs",
2349+
"from_",
2350+
"query",
2351+
"search_after",
2352+
"size",
2353+
"sort",
2354+
),
23472355
parameter_aliases={"from": "from_"},
23482356
)
23492357
async def query_api_keys(
23502358
self,
23512359
*,
2360+
aggregations: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
2361+
aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
23522362
error_trace: t.Optional[bool] = None,
23532363
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
23542364
from_: t.Optional[int] = None,
@@ -2373,13 +2383,28 @@ async def query_api_keys(
23732383
23742384
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-api-key.html>`_
23752385
2386+
:param aggregations: Any aggregations to run over the corpus of returned API
2387+
keys. Aggregations and queries work together. Aggregations are computed only
2388+
on the API keys that match the query. This supports only a subset of aggregation
2389+
types, namely: `terms`, `range`, `date_range`, `missing`, `cardinality`,
2390+
`value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations
2391+
only run over the same subset of fields that query works with.
2392+
:param aggs: Any aggregations to run over the corpus of returned API keys. Aggregations
2393+
and queries work together. Aggregations are computed only on the API keys
2394+
that match the query. This supports only a subset of aggregation types, namely:
2395+
`terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`,
2396+
`composite`, `filter`, and `filters`. Additionally, aggregations only run
2397+
over the same subset of fields that query works with.
23762398
:param from_: Starting document offset. By default, you cannot page through more
23772399
than 10,000 hits using the from and size parameters. To page through more
23782400
hits, use the `search_after` parameter.
2379-
:param query: A query to filter which API keys to return. The query supports
2380-
a subset of query types, including `match_all`, `bool`, `term`, `terms`,
2381-
`ids`, `prefix`, `wildcard`, and `range`. You can query all public information
2382-
associated with an API key.
2401+
:param query: A query to filter which API keys to return. If the query parameter
2402+
is missing, it is equivalent to a `match_all` query. The query supports a
2403+
subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
2404+
`ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
2405+
You can query the following public information associated with an API key:
2406+
`id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`,
2407+
`username`, `realm`, and `metadata`.
23832408
:param search_after: Search after definition
23842409
:param size: The number of hits to return. By default, you cannot page through
23852410
more than 10,000 hits using the `from` and `size` parameters. To page through
@@ -2417,6 +2442,10 @@ async def query_api_keys(
24172442
if with_limited_by is not None:
24182443
__query["with_limited_by"] = with_limited_by
24192444
if not __body:
2445+
if aggregations is not None:
2446+
__body["aggregations"] = aggregations
2447+
if aggs is not None:
2448+
__body["aggs"] = aggs
24202449
if from_ is not None:
24212450
__body["from"] = from_
24222451
if query is not None:

elasticsearch/_sync/client/inference.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,14 @@ def put_model(
214214
self,
215215
*,
216216
inference_id: str,
217+
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
218+
body: t.Optional[t.Mapping[str, t.Any]] = None,
217219
task_type: t.Optional[
218220
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
219221
] = None,
220222
error_trace: t.Optional[bool] = None,
221223
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
222224
human: t.Optional[bool] = None,
223-
model_config: t.Optional[t.Mapping[str, t.Any]] = None,
224-
body: t.Optional[t.Mapping[str, t.Any]] = None,
225225
pretty: t.Optional[bool] = None,
226226
) -> ObjectApiResponse[t.Any]:
227227
"""
@@ -230,8 +230,8 @@ def put_model(
230230
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html>`_
231231
232232
:param inference_id: The inference Id
233-
:param task_type: The task type
234233
:param model_config:
234+
:param task_type: The task type
235235
"""
236236
if inference_id in SKIP_IN_PATH:
237237
raise ValueError("Empty value passed for parameter 'inference_id'")
@@ -263,11 +263,7 @@ def put_model(
263263
if pretty is not None:
264264
__query["pretty"] = pretty
265265
__body = model_config if model_config is not None else body
266-
if not __body:
267-
__body = None
268-
__headers = {"accept": "application/json"}
269-
if __body is not None:
270-
__headers["content-type"] = "application/json"
266+
__headers = {"accept": "application/json", "content-type": "application/json"}
271267
return self.perform_request( # type: ignore[return-value]
272268
"PUT",
273269
__path,

elasticsearch/_sync/client/security.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,12 +2343,22 @@ def put_user(
23432343
)
23442344

23452345
@_rewrite_parameters(
2346-
body_fields=("from_", "query", "search_after", "size", "sort"),
2346+
body_fields=(
2347+
"aggregations",
2348+
"aggs",
2349+
"from_",
2350+
"query",
2351+
"search_after",
2352+
"size",
2353+
"sort",
2354+
),
23472355
parameter_aliases={"from": "from_"},
23482356
)
23492357
def query_api_keys(
23502358
self,
23512359
*,
2360+
aggregations: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
2361+
aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
23522362
error_trace: t.Optional[bool] = None,
23532363
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
23542364
from_: t.Optional[int] = None,
@@ -2373,13 +2383,28 @@ def query_api_keys(
23732383
23742384
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-query-api-key.html>`_
23752385
2386+
:param aggregations: Any aggregations to run over the corpus of returned API
2387+
keys. Aggregations and queries work together. Aggregations are computed only
2388+
on the API keys that match the query. This supports only a subset of aggregation
2389+
types, namely: `terms`, `range`, `date_range`, `missing`, `cardinality`,
2390+
`value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations
2391+
only run over the same subset of fields that query works with.
2392+
:param aggs: Any aggregations to run over the corpus of returned API keys. Aggregations
2393+
and queries work together. Aggregations are computed only on the API keys
2394+
that match the query. This supports only a subset of aggregation types, namely:
2395+
`terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`,
2396+
`composite`, `filter`, and `filters`. Additionally, aggregations only run
2397+
over the same subset of fields that query works with.
23762398
:param from_: Starting document offset. By default, you cannot page through more
23772399
than 10,000 hits using the from and size parameters. To page through more
23782400
hits, use the `search_after` parameter.
2379-
:param query: A query to filter which API keys to return. The query supports
2380-
a subset of query types, including `match_all`, `bool`, `term`, `terms`,
2381-
`ids`, `prefix`, `wildcard`, and `range`. You can query all public information
2382-
associated with an API key.
2401+
:param query: A query to filter which API keys to return. If the query parameter
2402+
is missing, it is equivalent to a `match_all` query. The query supports a
2403+
subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
2404+
`ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
2405+
You can query the following public information associated with an API key:
2406+
`id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`,
2407+
`username`, `realm`, and `metadata`.
23832408
:param search_after: Search after definition
23842409
:param size: The number of hits to return. By default, you cannot page through
23852410
more than 10,000 hits using the `from` and `size` parameters. To page through
@@ -2417,6 +2442,10 @@ def query_api_keys(
24172442
if with_limited_by is not None:
24182443
__query["with_limited_by"] = with_limited_by
24192444
if not __body:
2445+
if aggregations is not None:
2446+
__body["aggregations"] = aggregations
2447+
if aggs is not None:
2448+
__body["aggs"] = aggs
24202449
if from_ is not None:
24212450
__body["from"] = from_
24222451
if query is not None:

0 commit comments

Comments
 (0)