-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Search] Use Connector API for update_service_type #176306
[Search] Use Connector API for update_service_type #176306
Conversation
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
To update your PR or re-run it, just comment with: |
|
||
export const updateConnectorServiceType = async ( | ||
client: ElasticsearchClient, | ||
connectorId: string, | ||
serviceType: string | ||
) => { | ||
const connectorResult = await fetchConnectorById(client, connectorId); | ||
|
||
if (connectorResult?.value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it no longer necessary to confirm the connector doc exists first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, if document doesn't exist we return 404 from Connector API.
In status quo the check makes sure that we don't write partial update to the index directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be, it's fine if this errors out if the connector has been deleted. The only reason we're checking there is so we wouldn't have to do null checks inside the if
block and can spread the value easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
export const updateConnectorServiceType = async ( | ||
client: ElasticsearchClient, | ||
connectorId: string, | ||
serviceType: string | ||
) => { | ||
const connectorResult = await fetchConnectorById(client, connectorId); | ||
|
||
if (connectorResult?.value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be, it's fine if this errors out if the connector has been deleted. The only reason we're checking there is so we wouldn't have to do null checks inside the if
block and can spread the value easily.
## Summary Use connectors API for update service type operation
## Summary Use connectors API for update service type operation
## Summary Use connectors API for update service type operation
Summary
Use connectors API for update service type operation, it includes 2 actions:
Added unit tests. Also tested manually in serverless (this action is only used in serverless):
search-xd
indexsharepoint_online
and update the connector config with new service type (everything else remains unchanged)Checklist