mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Connectors] Removing index name should not remove connector (#183833)
In `Search indices` table, if you delete an index with a connector attached to it, it deletes both of them. This was the normally accepted behaviour but with 8.13 we decouple the connector and index. Ideally deleting and index should only delete index and not touch connector attached to it. Similar to the behaviour on `Connectors` table. The connector is not deleted, instead the referenced (deleted) index is detached from connector so that user gets the warning that they need to reconfigure the index once they navigate to connectors overview. We are still removing api keys and connector secrets associated with the deleted index. They need to be regenerated in the connector configuration tab.
This commit is contained in:
parent
68becd28df
commit
cb127727b4
2 changed files with 4 additions and 3 deletions
|
@ -12,7 +12,7 @@ import { ElasticsearchClient } from '@kbn/core/server';
|
|||
export const updateConnectorIndexName = async (
|
||||
client: ElasticsearchClient,
|
||||
connectorId: string,
|
||||
indexName: string
|
||||
indexName: string | null
|
||||
): Promise<Result> => {
|
||||
return await client.transport.request<Result>({
|
||||
method: 'PUT',
|
||||
|
|
|
@ -14,7 +14,7 @@ import { schema } from '@kbn/config-schema';
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { deleteConnectorById, deleteConnectorSecret } from '@kbn/search-connectors';
|
||||
import { deleteConnectorSecret, updateConnectorIndexName } from '@kbn/search-connectors';
|
||||
import {
|
||||
fetchConnectorByIndexName,
|
||||
fetchConnectors,
|
||||
|
@ -207,7 +207,8 @@ export function registerIndexRoutes({
|
|||
}
|
||||
|
||||
if (connector) {
|
||||
await deleteConnectorById(client.asCurrentUser, connector.id);
|
||||
// detach the deleted index without removing the connector
|
||||
await updateConnectorIndexName(client.asCurrentUser, connector.id, null);
|
||||
if (connector.api_key_id) {
|
||||
await client.asCurrentUser.security.invalidateApiKey({ ids: [connector.api_key_id] });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue