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

[Connectors] Use Connector API to manage connector filtering #183148

Merged

Conversation

jedrazb
Copy link
Member

@jedrazb jedrazb commented May 10, 2024

Summary

Use Connector API update filtering endpoint to manage connector filtering in Kibana.

I manually verified that the filtering management works as expected, and the error handling remains unchanged.

Screenshot 2024-05-10 at 14 12 52

The types returned by internal kibana actions remain unchanged.

Also added missing unit tests

Checklist

Delete any items that are not applicable to this PR.

@jedrazb jedrazb added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v8.15.0 labels May 10, 2024
@jedrazb jedrazb requested a review from a team as a code owner May 10, 2024 12:59
packages/kbn-search-connectors/lib/update_filtering.ts Outdated Show resolved Hide resolved
@@ -495,13 +495,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) {
elasticsearchErrorHandler(log, async (context, request, response) => {
const { client } = (await context.core).elasticsearch;
const { connectorId } = request.params;
const { advanced_snippet, filtering_rules } = request.body;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused whats happening with these parameters now, we still have advanced_snippet & filtering_rules on the request body but we're ignoring them now?

Copy link
Member Author

@jedrazb jedrazb May 13, 2024

Choose a reason for hiding this comment

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

I should have been clearer about this change. Those values correspond to values populated in draft filtering. Before we would take the draft advanced_snippet and filtering_rules and pass them to active filtering object. Now this copy-paste logic lives in ES, so we can just call _activate and it will lookup current draft in connector doc, and try to activate (with appropriate validation logc) whatever is listed as a draft rule.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, I forgot to clean up unused params from the request handler and associated logic, addressed it now :)

@jedrazb
Copy link
Member Author

jedrazb commented May 14, 2024

@elasticmachine merge upstream

filtering_rules: filteringRules,
}),
});
return await HttpLogic.values.http.put(route);
Copy link
Contributor

Choose a reason for hiding this comment

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

The route still has validation that requires the body do this request. Which means this call will always fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

Marked body as optional to preserve backwards compatibility in 0de6d2f

@TattdCodeMonkey
Copy link
Contributor

@elasticmachine merge upstream

@jedrazb jedrazb enabled auto-merge (squash) May 16, 2024 15:17
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

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
@kbn/search-connectors 3675 3672 -3

Async chunks

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

id before after diff
enterpriseSearch 2.7MB 2.7MB -237.0B
Unknown metric groups

API count

id before after diff
@kbn/search-connectors 3675 3672 -3

History

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

@jedrazb jedrazb merged commit 81679a9 into elastic:main May 16, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants