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

Allow passing a default operator to use on saved object client find operations #29339

Merged

Conversation

mikecote
Copy link
Contributor

@mikecote mikecote commented Jan 25, 2019

Fixes #29262.
Fixes #20676

Ability to pass in a default_operator for a saved object repository find call.

The default operator gets passed to the simple_query_string request to Elasticsearch.

This changes the default operator in the saved_object_loader.js to AND to make finding dashboards, visualizations, etc easier.

@mikecote mikecote added WIP Work in progress Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.0.0 labels Jan 25, 2019
@mikecote mikecote self-assigned this Jan 25, 2019
@mikecote mikecote requested a review from a team as a code owner January 25, 2019 14:15
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform

@mikecote mikecote changed the title Allow passing a default operator to use on find operations Allow passing a default operator to use on saved object client find operations Jan 25, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@kobelb kobelb left a comment

Choose a reason for hiding this comment

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

LGTM from the security perspective. The type/namespace filtering exists in a separate "clause" so it's not affected by the specified search operator.

@JacobBrandt
Copy link
Contributor

I have the same solution I made for 6.5 except for I checked that the searchOperator was defined before setting a value on that bool object. Does something else check that?

@timroes
Copy link
Contributor

timroes commented Jan 28, 2019

I stripped of part of the description, since the saved_object_loader isn't used at the moment in neither the dashboard listing nor the visualization listing pages, thus this PR itself won't improve the sorting there. It's used in dashboard to include saved searched and visualizations, but the other two need still to be fixed separately to specify that field (unless we set the default operator of the API to AND, but that would of course be a breaking change).

@mikecote
Copy link
Contributor Author

Spoke with @timroes and confirmed dashboard and visualizations are fixed with the code changes in this PR (they call saved_object_loader behind the scenes).

@JacobBrandt I added a fallback to OR so we should be ok on that now.

@mikecote mikecote added Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed WIP Work in progress labels Jan 28, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@elasticmachine

This comment has been minimized.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mikecote mikecote requested a review from spalger January 28, 2019 16:34
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mikecote
Copy link
Contributor Author

Spoke with @spalger and agreed we should rename searchOperator to defaultSearchOperator.

@mikecote mikecote requested a review from spalger January 28, 2019 19:21
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM, code review, thanks!

@mikecote mikecote requested a review from timroes January 30, 2019 13:58
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.

Tested the usage in saved_object_finder and saved_object_loader and that looks good to me.

@mikecote mikecote merged commit 9eef63f into elastic:master Jan 30, 2019
mikecote added a commit to mikecote/kibana that referenced this pull request Jan 30, 2019
…perations (elastic#29339)

* Allow passing a default operator to use on find operations

* Default operator to OR like elasticsearch to avoid passing null

* Add dashboard search tests

* Make search_operator optional

* Fix query_params.test.js

* Include searchOperator in saved_object_finder

* Apply PR feedback

* Rename searchOperator to defaultSearchOperator
@mikecote mikecote removed the v6.7.0 label Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:enhancement review Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants