Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
93ac07c
[Connector API] Add interface for soft-deletes
jedrazb Dec 9, 2024
12567b2
Define connector deleted system index
jedrazb Dec 10, 2024
4fdc2ca
Got soft-delete logic working
jedrazb Dec 10, 2024
d9be216
Add unit tests
jedrazb Dec 10, 2024
183ed7a
Add yaml e2e test and attempt to update permissions
jedrazb Dec 10, 2024
397032b
Fix permissions
jedrazb Dec 11, 2024
d8523e0
Update docs
jedrazb Dec 11, 2024
2640383
Merge branch 'main' into support-soft-deletes-to-connectors
elasticmachine Dec 11, 2024
6e1197c
Fix docs
jedrazb Dec 11, 2024
3d77bb2
Update docs/changelog/118282.yaml
jedrazb Dec 11, 2024
bf98ea8
Change logic
jedrazb Dec 12, 2024
b4eb411
Fix tests
jedrazb Dec 13, 2024
1b0845f
Remove unnecessary privilege from yaml rest test
jedrazb Dec 13, 2024
b51848e
Update changelog
jedrazb Dec 13, 2024
b206844
Update docs/changelog/118669.yaml
jedrazb Dec 13, 2024
3c0c5eb
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
elasticmachine Dec 13, 2024
5e02200
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
jedrazb Dec 16, 2024
6ff5a8d
Adapt yaml tests
jedrazb Dec 16, 2024
8557414
Merge branch 'support-soft-deletes-connectors-change-mapping' of gith…
jedrazb Dec 16, 2024
471643f
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
elasticmachine Dec 17, 2024
e697134
Undo changes to muted-tests.yml
jedrazb Dec 17, 2024
51ab020
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
elasticmachine Dec 18, 2024
4eb2a88
Fix compilation issue after other PR got merged
jedrazb Dec 18, 2024
7525c99
Exclude soft-deleted connector from checks about index_name already i…
jedrazb Dec 19, 2024
af7ad48
Update docs/reference/connector/apis/get-connector-api.asciidoc
jedrazb Dec 30, 2024
f09aad4
Update rest-api-spec/src/main/resources/rest-api-spec/api/connector.l…
jedrazb Dec 30, 2024
7a9a90d
Adapt comments, add connector wire serializing test
jedrazb Dec 30, 2024
7d1e901
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
elasticmachine Dec 30, 2024
8d4ec53
Introduce new transport versions for passing the delete flag
jedrazb Dec 30, 2024
bda4f8d
Merge branch 'support-soft-deletes-connectors-change-mapping' of gith…
jedrazb Dec 30, 2024
ea9394e
Get rid of wire serialisation, use include_deleted instead of deleted…
jedrazb Jan 8, 2025
27bab3c
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
jedrazb Jan 8, 2025
90862f2
Remove unused import
jedrazb Jan 8, 2025
4d848cb
Final tweaks
jedrazb Jan 9, 2025
dec45e6
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
elasticmachine Jan 9, 2025
8c7c24d
Merge branch 'main' into support-soft-deletes-connectors-change-mapping
jedrazb Jan 9, 2025
d2700e8
Adapt variable name in rest layer
jedrazb Jan 9, 2025
ca7bbde
Merge branch 'support-soft-deletes-connectors-change-mapping' of gith…
jedrazb Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/118669.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 118669
summary: "[Connector API] Support soft-deletes of connectors"
area: Extract&Transform
type: feature
issues: []
3 changes: 1 addition & 2 deletions docs/reference/connector/apis/delete-connector-api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

beta::[]

Removes a connector and associated sync jobs.
This is a destructive action that is not recoverable.
Soft-deletes a connector and removes associated sync jobs.

Note: this action doesn't delete any API key, ingest pipeline or data index associated with the connector. These need to be removed manually.

Expand Down
3 changes: 3 additions & 0 deletions docs/reference/connector/apis/get-connector-api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ To get started with Connector APIs, check out <<es-connectors-tutorial-api, our
`<connector_id>`::
(Required, string)

`deleted`::
(Optional, boolean) A flag indicating whether to also include connectors that have been soft-deleted. Defaults to `false`.

[[get-connector-api-response-codes]]
==== {api-response-codes-title}

Expand Down
3 changes: 3 additions & 0 deletions docs/reference/connector/apis/list-connectors-api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ To get started with Connector APIs, check out <<es-connectors-tutorial-api, our
`service_type`::
(Optional, string) A comma-separated list of connector service types, used to filter search results.

`deleted`::
(Optional, boolean) A flag indicating whether to also return connectors that have been soft-deleted. Defaults to `false`.

[[list-connector-api-example]]
==== {api-examples-title}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
}
}
]
},
"params": {
"deleted": {
"type": "boolean",
"default": false,
"description": "A flag indicating whether to return connectors that have been soft-deleted."
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
"query": {
"type": "string",
"description": "A search string for querying connectors, filtering results by matching against connector names, descriptions, and index names"
},
"deleted": {
"type": "boolean",
"default": false,
"description": "A flag indicating whether to list connectors that have been soft-deleted."
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@
},
"sync_now": {
"type": "boolean"
},
"deleted": {
"type": "boolean"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ setup:
- match: { results.1.language: "nl" }

---
"List Connector- with size":
"List Connector - with size":
- do:
connector.list:
size: 2
Expand Down Expand Up @@ -106,7 +106,6 @@ setup:

- match: { count: 0 }


---
"List Connector - filter by index names":
- do:
Expand Down Expand Up @@ -279,4 +278,145 @@ setup:
connector.list: { }


---
"List Connectors - Soft deleted connectors / no deleted":
- requires:
cluster_features: ["connector_soft_deletes"]
reason: Soft deletes were introduced in 9.0 release

- do:
connector.list:
deleted: true

- match: { count: 3 }


---
"List Connectors - Single soft deleted connector":
- requires:
cluster_features: ["connector_soft_deletes"]
reason: Soft deletes were introduced in 9.0 release

- do:
connector.delete:
connector_id: connector-a

- do:
connector.list: {}

- match: { count: 2 }

- do:
connector.list:
deleted: true

- match: { count: 3 }

---
"List Connectors - Soft deleted connectors":
- requires:
cluster_features: ["connector_soft_deletes"]
reason: Soft deletes were introduced in 9.0 release

- do:
connector.delete:
connector_id: connector-a
- do:
connector.delete:
connector_id: connector-b
- do:
connector.delete:
connector_id: connector-c

- do:
connector.list:
deleted: true

- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-b" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.0.language: "en" }
- match: { results.0.deleted: true }

- match: { results.1.id: "connector-a" }
- match: { results.1.index_name: "search-1-test" }
- match: { results.1.language: "pl" }
- match: { results.1.deleted: true }

- match: { results.2.id: "connector-c" }
- match: { results.2.index_name: "search-3-test" }
- match: { results.2.language: "nl" }
- match: { results.2.deleted: true }


---
"List Connectors - Soft deleted with from":
- requires:
cluster_features: ["connector_soft_deletes"]
reason: Soft deletes were introduced in 9.0 release

- do:
connector.delete:
connector_id: connector-a
- do:
connector.delete:
connector_id: connector-b
- do:
connector.delete:
connector_id: connector-c

- do:
connector.list:
from: 1
deleted: true

- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-a" }
- match: { results.0.index_name: "search-1-test" }
- match: { results.0.language: "pl" }
- match: { results.0.deleted: true }

- match: { results.1.id: "connector-c" }
- match: { results.1.index_name: "search-3-test" }
- match: { results.1.language: "nl" }
- match: { results.0.deleted: true }

---
"List Connector - Soft deleted with size":
- requires:
cluster_features: ["connector_soft_deletes"]
reason: Soft deletes were introduced in 9.0 release

- do:
connector.delete:
connector_id: connector-a
- do:
connector.delete:
connector_id: connector-b
- do:
connector.delete:
connector_id: connector-c

- do:
connector.list:
size: 2
deleted: true

- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-b" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.0.language: "en" }
- match: { results.0.deleted: true }

- match: { results.1.id: "connector-a" }
- match: { results.1.index_name: "search-1-test" }
- match: { results.1.language: "pl" }
- match: { results.1.deleted: true }


Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,33 @@ setup:
connector_id: test-nonexistent-connector


---
"Delete Connector - Supports soft deletes":
- requires:
cluster_features: ["connector_soft_deletes"]
reason: Soft deletes were introduced in 9.0 release

- do:
connector.delete:
connector_id: test-connector-to-delete

- match: { acknowledged: true }

- do:
catch: "missing"
connector.get:
connector_id: test-connector-to-delete

- do:
connector.get:
connector_id: test-connector-to-delete
deleted: true

- match: { id: test-connector-to-delete }
- match: { index_name: search-1-test }
- match: { service_type: super-connector }
- match: { name: my-connector }

---
"Delete connector fails for unprivileged user":
- skip:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.elasticsearch.features.FeatureSpecification;
import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.xpack.application.connector.ConnectorIndexService;
import org.elasticsearch.xpack.application.rules.action.ListQueryRulesetsAction;
import org.elasticsearch.xpack.application.rules.retriever.QueryRuleRetrieverBuilder;

Expand All @@ -23,7 +24,8 @@ public Set<NodeFeature> getFeatures() {
return Set.of(
QUERY_RULES_TEST_API,
QueryRuleRetrieverBuilder.QUERY_RULE_RETRIEVERS_SUPPORTED,
ListQueryRulesetsAction.QUERY_RULE_LIST_TYPES
ListQueryRulesetsAction.QUERY_RULE_LIST_TYPES,
ConnectorIndexService.CONNECTOR_SOFT_DELETES_FEATURE
);
}
}
Loading