Skip to content
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

[Data - Query Service] Move es-query back into a dedicated package #51659

Closed
3 tasks
lukeelmers opened this issue Nov 25, 2019 · 1 comment · Fixed by #103530
Closed
3 tasks

[Data - Query Service] Move es-query back into a dedicated package #51659

lukeelmers opened this issue Nov 25, 2019 · 1 comment · Fixed by #103530
Assignees
Labels
blocker chore Feature:KQL KQL impact:critical This issue should be addressed immediately due to a critical level of impact on the product. loe:large Large Level of Effort NeededFor:Core v8.0.0

Comments

@lukeelmers
Copy link
Member

lukeelmers commented Nov 25, 2019

In #42012 it was decided that we would move the @kbn/es-query package into the data plugin, which was merged in #51014.

In #41136, functionality was added to Saved Objects Client which allowed filtering using a KQL string. Internally, core was using the former @kbn/es-query package to parse the KQL.

Since es-query is no longer a standalone package, this means a dependency has been created between core (which owns saved objects), and data (which owns KQL). Having core depend on any other plugins runs counter to the overall design of the Kibana platform and blocks the upcoming migration to Bazel, so we need to go back and remove this dependency.

For the reasons discussed in #55485, core & app services agreed we should revert back to the previous approach of having es-query live as a standalone package of some type.

Edit The revised plan:

  • Move es-query back into a package
    • Specifically core uses fromKueryExpression, toElasticsearchQuery, and nodeTypes.function.buildNode, so at a minimum those functions are what need to be moved
  • Sort out what to do about types that es-query relies on from data (they will need to be moved into a package as well, otherwise they must be duplicated).
  • Cleanup task: remove src/plugins/expressions/server/index.ts from tsconfig.types.json
    • This was added in [expressions] AST Builder #64395 to prevent scripts/check_unpublished_api_changes compile errors which occurred as a result of core's dependency on data.

The plan discussed with @rudolf, @joshdover, and @Bargs is as follows:

- [ ] 1. @elastic/kibana-platform - #55485 Expose a generic ES filter api for Saved Objects find
- [ ] 2. @elastic/kibana-app-arch - After (1) is complete:
- [ ] Create a server API in the Data Query Service that can take Saved Object Client & a KQL query and validate/compile the KQL to an ES Filter which is passed to the SO client
- We should be able to reuse a lot of the existing code that does this from /src/core/server/saved_objects/service/lib/filter_utils.ts for this.
- [ ] Remove src/plugins/expressions/server/index.ts from tsconfig.types.json
- This was added in #64395 to prevent scripts/check_unpublished_api_changes compile errors which occurred as a result of core's dependency on data.

@lukeelmers lukeelmers added chore Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:KQL KQL Team:AppArch Feature:NP Migration labels Nov 25, 2019
@lukeelmers lukeelmers added blocker and removed Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels May 13, 2020
@lukeelmers lukeelmers changed the title [Data - Query Service] Create server API to use KQL in Saved Object queries [Data - Query Service] Move es-query back into a dedicated package Mar 11, 2021
@exalate-issue-sync exalate-issue-sync bot added impact:critical This issue should be addressed immediately due to a critical level of impact on the product. loe:small Small Level of Effort loe:medium Medium Level of Effort and removed loe:small Small Level of Effort labels Apr 26, 2021
@petrklapka petrklapka added 1 and removed 1 labels May 6, 2021
@lizozom
Copy link
Contributor

lizozom commented Jun 14, 2021

Dependencies
Current dependencies of es_query/es_query:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker chore Feature:KQL KQL impact:critical This issue should be addressed immediately due to a critical level of impact on the product. loe:large Large Level of Effort NeededFor:Core v8.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants