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

[Query] Use a minimal index pattern interface for es query #102364

Merged
merged 24 commits into from
Jun 23, 2021

Conversation

lizozom
Copy link
Contributor

@lizozom lizozom commented Jun 16, 2021

Summary

Part of #51659

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers


import { IFieldType } from '../../index_patterns';

export interface MinimalIndexPattern {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattkime do you have a better name for this?
And what do you think in general?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine. Its a bit hacky but it solves the problem without increasing complexity.

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think the approach here makes sense based on our conversation:

  • IIndexPattern stays as-is and extends from the base/minimal index pattern
  • The minimal interface in es_query makes it explicit exactly which pieces of index patterns es_query really depends on
  • It's simple

The main downside is that it feels awkward to have index patterns depend on es-query, but I don't think that's avoidable without duplicating the types.

import { IFieldType } from '../../index_patterns';

export interface MinimalIndexPattern {
fields: IFieldType[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the dependency on IFieldType[] going to be a problem too, whenever this gets split out into a package? I'd imagine you'd need to relocate that as well.

FWIW, if it starts to feel weird having all of this stuff crammed in a @kbn/es-query package, someone had proposed creating something like @kbn/data-types as a type-specific package just for the data plugin, so that these things could live there instead (and be imported by @kbn/es-query)

Neither option feels great, just wanted to mention it as something to consider.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I intend to handle IFieldType in a followup PR, before moving both into a package

@lizozom lizozom self-assigned this Jun 23, 2021
@lizozom lizozom added auto-backport Deprecated - use backport:version if exact versions are needed v7.14.0 v8.0.0 labels Jun 23, 2021
@lizozom lizozom marked this pull request as ready for review June 23, 2021 13:58
@lizozom lizozom requested a review from a team as a code owner June 23, 2021 13:58
@lizozom lizozom added release_note:skip Skip the PR/issue when compiling release notes Team:AppServices labels Jun 23, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, changes look good!

@lizozom
Copy link
Contributor Author

lizozom commented Jun 23, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
data 572 573 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
data 3272 3265 -7

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
data 165.4KB 165.4KB -96.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 832.8KB 832.4KB -485.0B
Unknown metric groups

API count

id before after diff
data 3837 3830 -7

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @lizozom

@lizozom lizozom merged commit 77fe1c1 into elastic:master Jun 23, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

To backport manually run:
node scripts/backport --pr 102364

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 25, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 102364 or prevent reminders by adding the backport:skip label.

lizozom added a commit to lizozom/kibana that referenced this pull request Jun 28, 2021
…02364)

* Move JSON utils to utils package

* Imports from tests

* delete

* split package

* docs

* test

* test

* imports

* minimal index pattern

* move some functions out and use miniaml ip in all es-kuery

* docs

* docs

* rename

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md
#	src/plugins/data/public/public.api.md
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 28, 2021
lizozom added a commit that referenced this pull request Jun 28, 2021
…103453)

* Move JSON utils to utils package

* Imports from tests

* delete

* split package

* docs

* test

* test

* imports

* minimal index pattern

* move some functions out and use miniaml ip in all es-kuery

* docs

* docs

* rename

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md
#	src/plugins/data/public/public.api.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants