Skip to content

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

Merged
mikecote merged 9 commits into
elastic:masterfrom
mikecote:saved-object/configure-find-operator
Jan 30, 2019
Merged

mikecote merged 9 commits into
elastic:masterfrom
mikecote:saved-object/configure-find-operator

Conversation

@mikecote

@mikecote mikecote commented Jan 25, 2019 •

Copy link
Copy Markdown
Contributor

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 Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// 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
Copy Markdown
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
Copy Markdown
Contributor

💚 Build Succeeded

@kobelb kobelb left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

timroes commented Jan 28, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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 Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// and removed WIP Work in progress labels Jan 28, 2019
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app

@elasticmachine

This comment has been minimized.

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@mikecote
mikecote requested a review from spalger January 28, 2019 16:34
Comment thread src/server/saved_objects/routes/find.js Outdated
Comment thread src/server/saved_objects/service/lib/search_dsl/query_params.js Outdated
@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@mikecote

Copy link
Copy Markdown
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
Copy Markdown
Contributor

💚 Build Succeeded

@spalger spalger left a comment

Copy link
Copy Markdown
Contributor

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

@timroes timroes left a comment

Copy link
Copy Markdown
Contributor

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
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
…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
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 Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants