-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SavedObjects] Add aggregations support #96292
Merged
pgayvallet
merged 76 commits into
elastic:master
from
pgayvallet:kbn-xxx-SO-aggrs-reborn
Apr 16, 2021
Merged
Changes from 72 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
b699c70
step 1 to add aggs in the find function of saved object
XavierM 3819cd5
setp 2 - add specific unit test to aggs + fix bug found during integr…
XavierM 1c4bac9
step 3 - add security api_integration arounds aggs
XavierM 6feca9b
fix types
XavierM 8dda821
unit test added for aggs_utils
XavierM 0904a0e
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 44dcb25
add documentation
XavierM 560b63b
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 699d0a1
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 0f57677
fix docs
XavierM d7cb38e
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM ec2a69d
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 817a3ef
review I
XavierM f7faa18
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM a54f440
doc
XavierM 2aef7fd
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM e698b0e
try to fix test
XavierM 09565d8
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM c16e72b
add the new property to the saved object globaltype
XavierM 5a12d44
fix types
XavierM c4eff53
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 1eaafca
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM f04ab64
delete old files
XavierM 8f64144
fix types + test api integration
XavierM 2209d12
type fix + test
XavierM 4f667d4
Update src/core/server/saved_objects/types.ts
XavierM 433a71c
review I
XavierM 37ad64d
Merge branch 'saved-objects-aggs' of github.com:XavierM/kibana into s…
XavierM 2fb9a2c
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 48dcdda
Merge branch 'master' into saved-objects-aggs
kibanamachine 2dc3ff8
Merge branch 'master' into saved-objects-aggs
kibanamachine f1f437b
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM b23eac7
change our validation to match discussion with Pierre and Rudolph
XavierM 462d87e
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 4e319b3
Validate multiple items nested filter query through KueryNode
XavierM ba55542
Merge branch 'master' of github.com:elastic/kibana into saved-objects…
XavierM 16de875
remove unused import
XavierM cb7ada3
review + put back test
XavierM 3ce2a4d
Merge remote-tracking branch 'upstream/master' into kbn-xxx-SO-aggrs-…
pgayvallet b88bbbd
migrate added tests to new TS file
pgayvallet 3682d30
fix documentation
pgayvallet 3d37556
fix license header
pgayvallet fa35f93
move stuff
pgayvallet 3efad5b
duplicating test mappings
pgayvallet af2b743
rename some stuff
pgayvallet 2bb16d0
move ALL the things
pgayvallet e150741
cast to aggregation container
pgayvallet f60cb6f
update generated doc
pgayvallet 2efb54c
add deep nested validation
pgayvallet 4adf27d
rewrite the whole validation mechanism
pgayvallet bfb812d
some cleanup
pgayvallet 5514d77
Merge remote-tracking branch 'upstream/master' into kbn-xxx-SO-aggrs-…
pgayvallet 62d3d69
minor cleanup
pgayvallet 4e2ae77
update generated doc
pgayvallet 4bae5b9
adapt telemetry client
pgayvallet 2279447
fix API integ tests
pgayvallet 8099f36
fix doc
pgayvallet ecc8d2d
TOTO-less
pgayvallet 08ce7d5
remove xpack tests
pgayvallet 2aef2d8
list supported / unsupported aggregations
pgayvallet 0ffe804
typo fix
pgayvallet 90dc2a1
extract some validation function
pgayvallet ccc50df
fix indent
pgayvallet eda6b74
add some unit tests
pgayvallet 4d4b377
Merge remote-tracking branch 'upstream/master' into kbn-xxx-SO-aggrs-…
pgayvallet c8c8bec
Merge remote-tracking branch 'upstream/master' into kbn-xxx-SO-aggrs-…
pgayvallet 5d0e352
adapt FTR assertions
pgayvallet 8d9e41f
update doc
pgayvallet 5c6d3ac
fix doc
pgayvallet c167987
doc again
pgayvallet 5239a44
cleanup test names
pgayvallet cb0327c
improve tsdoc on validation functions
pgayvallet 705fe34
Merge remote-tracking branch 'upstream/master' into kbn-xxx-SO-aggrs-…
pgayvallet fba668e
perf nit
pgayvallet 96f6a86
Merge remote-tracking branch 'upstream/master' into kbn-xxx-SO-aggrs-…
pgayvallet 1adf244
Merge remote-tracking branch 'upstream/master' into kbn-xxx-SO-aggrs-…
pgayvallet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some fields / shapes could easily be factorized (e.g
extended_bounds
andhard_bounds
are the same TS type inAggregationContainer
), but I'd rather do that later when we'll get some feedback on the usability of the API.