kibana/packages/core/saved-objects/core-saved-objects-api-server-internal
Jiawei Wu 50e2723268
[RAM] Modify rules client aggregate method to allow for custom aggregations (#149966)
## Summary
Resolves: https://github.com/elastic/kibana/issues/131682

Taking inspiration from this PR: https://github.com/elastic/kibana/pull/148382

This PR changes the rules client aggregation method to accept arbitrary aggregations. This allows the users of the method to better customize the response when calling rules client aggregate. We have added validation to the aggregate method to prevent aggregations on certain rule fields.

```ts
const ALLOW_FIELDS = [
  'alert.attributes.executionStatus.status',
  'alert.attributes.lastRun.outcome',
  'alert.attributes.muteAll',
  'alert.attributes.tags',
  'alert.attributes.snoozeSchedule',
  'alert.attributes.snoozeSchedule.duration',
  'alert.attributes.alertTypeId',
  'alert.attributes.enabled',
  'alert.attributes.params.*',
];

const ALLOW_AGG_TYPES = ['terms', 'composite', 'nested', 'filter'];
```

This PR also adds a new endpoint `rules/_tags` to allow for pagination of rule tags. This new endpoint takes advantage of the arbitrary aggregation of the new aggregate method. 

I tested the security solution rules page to ensure tags are still loading as expected.

### Checklist
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
2023-03-08 12:28:05 -07:00
..
src [RAM] Modify rules client aggregate method to allow for custom aggregations (#149966) 2023-03-08 12:28:05 -07:00
index.ts Migrate remaining parts of server-side SO domain to packages (#139305) 2022-08-26 01:53:37 -07:00
jest.config.js Migrate remaining parts of server-side SO domain to packages (#139305) 2022-08-26 01:53:37 -07:00
kibana.jsonc Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
package.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
README.md Migrate remaining parts of server-side SO domain to packages (#139305) 2022-08-26 01:53:37 -07:00
tsconfig.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00

@kbn/core-saved-objects-api-server-internal

This package contains the internal implementation of core's server-side savedObjects client and repository.