-
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
Expose elasticsearch config schema #57655
Conversation
Pinging @elastic/kibana-platform (Team:Platform) |
We could expose an Observable interface that consumes the raw config and produces clients: // on ElasticsearchSetup
// This would automatically swap out client instances under-the-hood just like
// dataClient
createClusterClient(config$: Observable<ElasticsearchConfigType>): ClusterClient;
// in plugin code
export const config = {
schema: schema.object({
monitoringCluster: coreConfig.elasticsearch.schema
})
}
class Plugin {
setup(core) {
const monitoringCluster = core.elasticsearch.createClusterClient$(
this.config$.pipe(map(c => c.monitoringCluster))
);
}
} |
I like the suggestion of a |
@joshdover @rudolf any actionable comments to merge this PR? |
@elasticmachine merge upstream |
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.
Don't have any reason to block on this, but one suggestion might be to mark these exports as @alpha
since we may (will?) change these later.
```typescript | ||
config: { | ||
elasticsearch: { | ||
schema: import("@kbn/config-schema").ObjectType<{ |
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.
Wow api-extractor
, this is ugly 🙁
5c0193c
to
cab9176
Compare
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* expose elasticsearch config schema * update docs * mark export as alpha since it can be deleted Co-authored-by: Elastic Machine <[email protected]>
…-out-of-legacy * 'master' of github.com:elastic/kibana: (109 commits) document difference between log record formats (elastic#57798) Expose elasticsearch config schema (elastic#57655) [ui/agg_response/tabify] update types for search/expressions/build_tabular_inspector_data.ts (elastic#58130) [SIEM] Cleans Cypress tests code (elastic#58134) fix: 🐛 make dev server Storybook builds work again (elastic#58188) Prevent core savedObjects plugin from being overridden (elastic#58193) Expose serverBasePath on client-side (elastic#58070) Fix legend sizing on area charts (elastic#58083) Drilldown plugin (elastic#58097) [skip-ci] Fix broken links to saved objects APIs in MIGRATION.md (elastic#58033) [ML] New Platform server shim: update datafeed routes (elastic#57739) Add flag for building static storybook site (elastic#58050) add monaco to kbn/ui-shared-deps and load required features for all uses (elastic#58075) [SIEM] Let us try out code owners for a little while and see what happens Add throttle param to Alerting readme (elastic#57609) [NP] Move ui/saved_objects to NP (elastic#57452) [Logs UI] Fix column reordering in settings page (elastic#58104) Fix browser date format (elastic#57714) Add filter for ILM phase to Index Management (revert elastic#45486) (elastic#57402) Clarify Precision function in Timelion Kibana (elastic#58031) ... # Conflicts: # x-pack/.i18nrc.json
* expose elasticsearch config schema * update docs * mark export as alpha since it can be deleted Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
…_improve-advanced-settings-save * commit '02efb01c481f9f24d8d707f06dfc68b2fb805001': (43 commits) [Endpoint] Add a flyout to alert list. (elastic#57926) Make sure index pattern has fields before parsing (elastic#58242) Sanitize workpad before sending to API (elastic#57704) [ML] Transform: Support multi-line JSON notation in advanced editor (elastic#58015) [Endpoint] Refactor Management List Tests (elastic#58148) [kbn/optimizer] include bootstrap cache key in optimizer cache key (elastic#58176) Do not refresh color scale on each lookup (elastic#57792) Updating to @elastic/[email protected] (elastic#54662) Trigger context (elastic#57870) [ML] Transforms: Adds clone feature to transforms list. (elastic#57837) [ML] New Platform server shim: update fields service routes (elastic#58060) [Endpoint] EMT-184: change endpoints to metadata up and down the code base. (elastic#58038) document difference between log record formats (elastic#57798) Expose elasticsearch config schema (elastic#57655) [ui/agg_response/tabify] update types for search/expressions/build_tabular_inspector_data.ts (elastic#58130) [SIEM] Cleans Cypress tests code (elastic#58134) fix: 🐛 make dev server Storybook builds work again (elastic#58188) Prevent core savedObjects plugin from being overridden (elastic#58193) Expose serverBasePath on client-side (elastic#58070) Fix legend sizing on area charts (elastic#58083) ...
Summary
Closes #56872, #56618
Required to unblock Monitoring plugin migration.
Plugins are allowed to create a custom elasticsearch config that will be used for custom elasticsearch clients. Although I only found that
monitoring
allows to re-define elasticsearch config values.The current implementation is the most straightforward and there are several things that I don't like:
@kbn/config-schema
doesn't allow to re-write validation rules locally. YAGNI, but I can imagine such a requirement in the future.I think we can live with it for some time, but I assume we may want to refactor this part. To get rid of
ElasticsearchConfig
class of to move elasticsearch config validation to the platform, for example. Should I open a discussion about it or we are okay with the current approach?For maintainers