-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SavedObjects] Add aggregations support (#96292)
* step 1 to add aggs in the find function of saved object * setp 2 - add specific unit test to aggs + fix bug found during integrations * step 3 - add security api_integration arounds aggs * fix types * unit test added for aggs_utils * add documentation * fix docs * review I * doc * try to fix test * add the new property to the saved object globaltype * fix types * delete old files * fix types + test api integration * type fix + test * Update src/core/server/saved_objects/types.ts Co-authored-by: Rudolf Meijering <[email protected]> * review I * change our validation to match discussion with Pierre and Rudolph * Validate multiple items nested filter query through KueryNode * remove unused import * review + put back test * migrate added tests to new TS file * fix documentation * fix license header * move stuff * duplicating test mappings * rename some stuff * move ALL the things * cast to aggregation container * update generated doc * add deep nested validation * rewrite the whole validation mechanism * some cleanup * minor cleanup * update generated doc * adapt telemetry client * fix API integ tests * fix doc * TOTO-less * remove xpack tests * list supported / unsupported aggregations * typo fix * extract some validation function * fix indent * add some unit tests * adapt FTR assertions * update doc * fix doc * doc again * cleanup test names * improve tsdoc on validation functions * perf nit Co-authored-by: Xavier Mouligneau <[email protected]> Co-authored-by: Rudolf Meijering <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
15e8ca1
commit 106afd4
Showing
34 changed files
with
1,369 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...public/kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [SavedObjectsFindResponsePublic](./kibana-plugin-core-public.savedobjectsfindresponsepublic.md) > [aggregations](./kibana-plugin-core-public.savedobjectsfindresponsepublic.aggregations.md) | ||
|
||
## SavedObjectsFindResponsePublic.aggregations property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
aggregations?: A; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../core/server/kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsFindResponse](./kibana-plugin-core-server.savedobjectsfindresponse.md) > [aggregations](./kibana-plugin-core-server.savedobjectsfindresponse.aggregations.md) | ||
|
||
## SavedObjectsFindResponse.aggregations property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
aggregations?: A; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/core/server/saved_objects/service/lib/aggregations/aggs_types/bucket_aggs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { schema as s, ObjectType } from '@kbn/config-schema'; | ||
|
||
/** | ||
* Schemas for the Bucket aggregations. | ||
* | ||
* Currently supported: | ||
* - filter | ||
* - histogram | ||
* - terms | ||
* | ||
* Not implemented: | ||
* - adjacency_matrix | ||
* - auto_date_histogram | ||
* - children | ||
* - composite | ||
* - date_histogram | ||
* - date_range | ||
* - diversified_sampler | ||
* - filters | ||
* - geo_distance | ||
* - geohash_grid | ||
* - geotile_grid | ||
* - global | ||
* - ip_range | ||
* - missing | ||
* - multi_terms | ||
* - nested | ||
* - parent | ||
* - range | ||
* - rare_terms | ||
* - reverse_nested | ||
* - sampler | ||
* - significant_terms | ||
* - significant_text | ||
* - variable_width_histogram | ||
*/ | ||
export const bucketAggsSchemas: Record<string, ObjectType> = { | ||
filter: s.object({ | ||
term: s.recordOf(s.string(), s.oneOf([s.string(), s.boolean(), s.number()])), | ||
}), | ||
histogram: s.object({ | ||
field: s.maybe(s.string()), | ||
interval: s.maybe(s.number()), | ||
min_doc_count: s.maybe(s.number()), | ||
extended_bounds: s.maybe( | ||
s.object({ | ||
min: s.number(), | ||
max: s.number(), | ||
}) | ||
), | ||
hard_bounds: s.maybe( | ||
s.object({ | ||
min: s.number(), | ||
max: s.number(), | ||
}) | ||
), | ||
missing: s.maybe(s.number()), | ||
keyed: s.maybe(s.boolean()), | ||
order: s.maybe( | ||
s.object({ | ||
_count: s.string(), | ||
_key: s.string(), | ||
}) | ||
), | ||
}), | ||
terms: s.object({ | ||
field: s.maybe(s.string()), | ||
collect_mode: s.maybe(s.string()), | ||
exclude: s.maybe(s.oneOf([s.string(), s.arrayOf(s.string())])), | ||
include: s.maybe(s.oneOf([s.string(), s.arrayOf(s.string())])), | ||
execution_hint: s.maybe(s.string()), | ||
missing: s.maybe(s.number()), | ||
min_doc_count: s.maybe(s.number()), | ||
size: s.maybe(s.number()), | ||
show_term_doc_count_error: s.maybe(s.boolean()), | ||
order: s.maybe(s.oneOf([s.literal('asc'), s.literal('desc')])), | ||
}), | ||
}; |
15 changes: 15 additions & 0 deletions
15
src/core/server/saved_objects/service/lib/aggregations/aggs_types/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { bucketAggsSchemas } from './bucket_aggs'; | ||
import { metricsAggsSchemas } from './metrics_aggs'; | ||
|
||
export const aggregationSchemas = { | ||
...metricsAggsSchemas, | ||
...bucketAggsSchemas, | ||
}; |
Oops, something went wrong.