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

Use Search API in Vega #68257

Merged
merged 6 commits into from
Jun 9, 2020
Merged

Use Search API in Vega #68257

merged 6 commits into from
Jun 9, 2020

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Jun 4, 2020

Closes: #67584

Summary

The old elasticsearch client is deprecated and we need to switch away from it. We should use App Arch's Search API instead to send the raw DSL in Vega.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@alexwizp
Copy link
Contributor Author

alexwizp commented Jun 5, 2020

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

merge conflict between base and head

# Conflicts:
#	src/plugins/data/public/search/fetch/get_search_params.ts
@alexwizp alexwizp self-assigned this Jun 5, 2020
@alexwizp alexwizp added Feature:Vega Vega visualizations Feature:Search Querying infrastructure in Kibana Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:skip Skip the PR/issue when compiling release notes Feature:NP Migration labels Jun 5, 2020
@alexwizp alexwizp marked this pull request as ready for review June 5, 2020 08:53
@alexwizp alexwizp requested a review from a team June 5, 2020 08:53
@alexwizp alexwizp requested review from a team as code owners June 5, 2020 08:53
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@alexwizp
Copy link
Contributor Author

alexwizp commented Jun 8, 2020

@elasticmachine merge upstream

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

Added a couple of comments on implementation.
Didn't test Vega yet.

maxAge: 4 * 1000,
});
if (!searchAPI) {
searchAPI = new SearchAPI({ search: getData().search }, abortSignal);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need getData if this function gets data plugin as a dependency?

@@ -171,6 +172,13 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
return new SearchSource({}, searchSourceDependencies);
},
},
searchParams: {
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 it would be really simple to add this function as a utility, passing in core from the caller.
I don't see any reason to have this as part of the contract, as it's only used to migrate old requests to the new search service format, and won't be a part of the API long term

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liza-mae np, will move it into static contract. My idea was to bind the required dependencies...

Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong liza :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

=)

@@ -53,3 +54,18 @@ export function getPreference(config: IUiSettingsClient) {
export function getTimeout(esShardTimeout: number) {
return esShardTimeout > 0 ? `${esShardTimeout}ms` : undefined;
}

export function getSearchParamsFromRequest(
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this!

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM for SOM plugin changes

Comment on lines 281 to 283
"searchParams": Object {
"createFromRequest": [MockFunction],
},
Copy link
Contributor

Choose a reason for hiding this comment

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

That's not the first PR that is forced to update this snapshot. This should not be needed. Gonna fix the test to just assert existence of the Flyout component. Snapshot testing the props has really low value here, and behavior is already covered in FTR test anyway

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #68489

@@ -641,6 +642,23 @@ export function getQueryLog(uiSettings: IUiSettingsClient, storage: IStorageWrap
// @public (undocumented)
export function getSearchErrorType({ message }: Pick<SearchError, 'message'>): "UNSUPPORTED_QUERY" | undefined;

// Warning: (ae-missing-release-tag) "getSearchParamsFromRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe mark this as @internal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lizozom not sure, becase we use it at least in 2 different plugins: data, vis_type_vega

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

LGTM
Haven't checked out to test

# Conflicts:
#	src/plugins/data/public/public.api.md
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@alexwizp
Copy link
Contributor Author

alexwizp commented Jun 9, 2020

ping @elastic/kibana-app

Copy link
Contributor

@stratoula stratoula 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, have tested it on chrome, safari and ff. Old vega visualizations work as expected and also new ones.

@alexwizp alexwizp merged commit 5d8de7a into elastic:master Jun 9, 2020
alexwizp added a commit to alexwizp/kibana that referenced this pull request Jun 9, 2020
* Use Search API in Vega

* fix PR comments

* fix PR comments
alexwizp added a commit that referenced this pull request Jun 10, 2020
* Use Search API in Vega

* fix PR comments

* fix PR comments

Co-authored-by: Elastic Machine <[email protected]>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jun 10, 2020
* master: (22 commits)
  Partial revert of "Sync Kerberos + Anonymous access tests with the latest `security/_authenticate` API (user roles now include roles of anonymous user)." (elastic#68624)
  adapt some snapshot test (elastic#68489)
  [APM] Service maps - Fix missing ML status for services with jobs but no anomalies (elastic#68486)
  [skip test] apis Kerberos security Kerberos authentication finishing SPNEGO should properly set cookie and authenticate user
  [SIEM][Exceptions] - ExceptionsViewer UI component part 2 (elastic#68294)
  Surface data streams in Index Management. (elastic#67806)
  Fix edit datasource not working following changes in elastic#67234 (elastic#68583)
  [Logs + Metrics UI] Clean up async plugin initialization (elastic#67654)
  APM Storybook fixes (elastic#68671)
  Upgrade EUI to v24.1.0 (elastic#68141)
  [ML] DF Analytics: Creation wizard part 2 (elastic#68462)
  [Uptime] Fix race on overview page query (elastic#67843)
  Prefer using npm_execpath when spawning Yarn (elastic#68673)
  [Security] [Cases] Attach timeline to existing case (elastic#68580)
  Use Search API in Vega (elastic#68257)
  [Component templates] Table view (elastic#68031)
  [Uptime] Added relative date info in cert status column (elastic#67612)
  [Endpoint] Re-enable Functional test case for Endpoint related pages (elastic#68445)
  run page_load_metrics tests in visual regresssion jobs (elastic#68570)
  Enable exhaustive-deps; correct any lint warnings (elastic#68453)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration Feature:Search Querying infrastructure in Kibana Feature:Vega Vega visualizations release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Search API in Vega
6 participants