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

Index patterns api - load field list on server #81218

Merged

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Oct 20, 2020

Summary

The server side index patterns api can now load the field list. Previously it would error if a field list refresh was required.

The regular and rollup index pattern field list loading methods were merged. Rollup index patterns require additional functionality over regular index patterns when it comes to loading the field list, but this won't be necessary once rollups v2 is released.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

mattkime and others added 30 commits October 11, 2020 22:49
…:mattkime/kibana into field_caps_remove_legacy_es_client_usage
@mattkime mattkime added the v8.0.0 label Nov 1, 2020
@mattkime mattkime marked this pull request as ready for review November 1, 2020 02:17
@mattkime mattkime requested review from a team as code owners November 1, 2020 02:17
@mattkime mattkime requested a review from a team November 1, 2020 02:17
@mattkime mattkime requested a review from a team as a code owner November 1, 2020 02:17
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@elastic elastic deleted a comment from kibanamachine Nov 1, 2020
@mattkime mattkime linked an issue Nov 2, 2020 that may be closed by this pull request
Copy link
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

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

One proposed change and afterwards I don't think there will be any changes in the alerting code :)

@@ -301,6 +301,7 @@ export class AlertingPlugin {
): (request: KibanaRequest) => Services {
return (request) => ({
callCluster: elasticsearch.legacy.client.asScoped(request).callAsCurrentUser,
esClient: elasticsearch.client.asScoped(request).asCurrentUser,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be able to use scopedClusterClient below.

Suggested change
esClient: elasticsearch.client.asScoped(request).asCurrentUser,

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

Rubberstamping the ES UI codeowner request since the portions of the rollup plugin that were touched aren't owned by us.

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

distributable file count

id before after diff
default 42705 42703 -2
oss 22410 22413 +3

page load bundle size

id before after diff
data 954.7KB 955.0KB +251.0B
rollup 65.1KB 65.1KB -10.0B
total +241.0B

History

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

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

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

Reviewed Kibana App code change only. Code LGTM

@mattkime mattkime merged commit e683ece into elastic:master Nov 4, 2020
mattkime added a commit to mattkime/kibana that referenced this pull request Nov 4, 2020
Index patterns api - load field list on server
spalger added a commit that referenced this pull request Nov 4, 2020
@spalger
Copy link
Contributor

spalger commented Nov 4, 2020

Sorry, this caused failures on master once merged so I had to revert. https://kibana-ci.elastic.co/job/elastic+kibana+master/9408/execution/node/459/log

Comment on lines +72 to +75
asScopedToClient: async (
savedObjectsClient: SavedObjectsClientContract,
elasticsearchClient: ElasticsearchClient
) => {
Copy link
Member

Choose a reason for hiding this comment

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

@mattkime Just stumbled across this change now -- I'm wondering if it would be simpler to instead do:

asScoped: async (request: KibanaRequest) => {...}

Since both the scoped saved objects & es clients can be derived from a kibana request:

const savedObjectsClient = savedObjects.getScopedClient(req);
const elasticsearchClient = elasticsearch.client.asScoped(req);

The reason I called this asScopedToClient in the first place was because it mirrored the signature of uiSettings.asScopedToClient which only takes in a scoped SO client. Now that we've changed it, the naming is a bit more confusing IMHO.

In the search service (both low level & search source), we've used asScoped(req: KibanaRequest), so this would also make things consistent with the other search services.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought this was following the general principle of asking for for the more specific dependencies over more general. That said, I'm definitely open to improvements in the code. Mind opening a PR?

Copy link
Member

Choose a reason for hiding this comment

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

principle of asking for for the more specific dependencies over more general

Yeah, that's a fair point and I agree the whole KibanaRequest might not always be necessary. I guess it's more of a consistency-vs-explicitness tradeoff. I think I was getting hung up on the naming here in particular though; I'll give it some thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Views Data Views code and UI - index patterns before 8.0 release_note:skip Skip the PR/issue when compiling release notes reverted v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Index patterns server side functional tests
10 participants