Skip to content

Commit 6392b76

Browse files
Auto-generated API code
1 parent cafeba0 commit 6392b76

File tree

3 files changed

+70
-12
lines changed

3 files changed

+70
-12
lines changed

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/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ class Elasticsearch(BaseClient):
122122
# Set 'api_key' on the constructor
123123
client = Elasticsearch(
124124
"http://localhost:9200",
125-
api_key="api_key",
125+
api_key=("id", "api_key")
126126
)
127127
client.search(...)
128128
129129
# Set 'api_key' per request
130-
client.options(api_key="api_key").search(...)
130+
client.options(api_key=("id", "api_key")).search(...)
131131
"""
132132

133133
def __init__(

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)