Skip to content

Support for aggregations in Security's Query API Key Information API #2455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions specification/security/query_api_keys/QueryApiKeysRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import { Dictionary } from '@spec_utils/Dictionary'
import { AggregationContainer } from '@_types/aggregations/AggregationContainer'
import { RequestBase } from '@_types/Base'
import { integer } from '@_types/Numeric'
import { QueryContainer } from '@_types/query_dsl/abstractions'
Expand All @@ -42,9 +44,20 @@ export interface Request extends RequestBase {
}
body: {
/**
* Any aggregations to run over the corpus of returned API keys.
* Aggregations and queries work together. Aggregations are computed only on the API keys that match the query.
* This supports only a subset of aggregation types, namely: `terms`, `range`, `date_range`, `missing`,
* `cardinality`, `value_count`, `composite`, `filter`, and `filters`.
* Additionally, aggregations only run over the same subset of fields that query works with.
* @aliases aggs */
aggregations?: Dictionary<string, AggregationContainer>
/**
* A query to filter which API keys to return.
* The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `ids`, `prefix`, `wildcard`, and `range`.
* You can query all public information associated with an API key.
* If the query parameter is missing, it is equivalent to a `match_all` query.
* The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
* `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
* You can query the following public information associated with an API key: `id`, `type`, `name`,
* `creation`, `expiration`, `invalidated`, `invalidation`, `username`, `realm`, and `metadata`.
*/
query?: QueryContainer
/**
Expand Down
7 changes: 7 additions & 0 deletions specification/security/query_api_keys/QueryApiKeysResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import { ApiKey } from '@security/_types/ApiKey'
import { integer } from '@_types/Numeric'
import { Dictionary } from '@spec_utils/Dictionary'
import { Aggregate } from '@_types/aggregations/Aggregate'
import { AggregateName, Id, ScrollId, SuggestionName } from '@_types/common'

export class Response {
body: {
Expand All @@ -34,5 +37,9 @@ export class Response {
* A list of API key information.
*/
api_keys: ApiKey[]
/**
* The aggregations result, if requested.
*/
aggregations?: Dictionary<AggregateName, Aggregate>
}
}