Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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/118282.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 118282
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 return 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 return connectors that have been soft-deleted. Defaults to `false`.

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

Expand Down
2 changes: 0 additions & 2 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ tests:
- class: org.elasticsearch.search.StressSearchServiceReaperIT
method: testStressReaper
issue: https://github.com/elastic/elasticsearch/issues/115816
- class: org.elasticsearch.xpack.application.connector.ConnectorIndexServiceTests
issue: https://github.com/elastic/elasticsearch/issues/116087
Comment on lines -100 to -101
Copy link
Member

Choose a reason for hiding this comment

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

What about unmuting the tests?

Copy link
Member

Choose a reason for hiding this comment

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

++

Copy link
Member Author

@jedrazb jedrazb Dec 11, 2024

Choose a reason for hiding this comment

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

It got muted due couple of flakey runs recently ... I checked the logs and it seemed to be weird ES error. It has been running for almost a year now fine

- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=cat.shards/10_basic/Help}
issue: https://github.com/elastic/elasticsearch/issues/116110
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."
Copy link
Member

Choose a reason for hiding this comment

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

Should we say that it's listing "only" deleted connectors, not all together?

}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to have a test that checks that both deleted and non-deleted indices have the same schema?

Additionally, does it make sense to make a lot of properties here searchable? Or we wanna have filters on deleted connectors too?

"settings": {
"index": {
"number_of_shards": "1",
"auto_expand_replicas": "0-1"
}
},
"mappings":{
"_doc":{
"dynamic":"false",
"_meta": {
"version": "${connectors-deleted.version}",
"managed_index_mappings_version": ${connectors-deleted.managed.index.version}
},
"properties":{
"api_key_id":{
"type":"keyword"
},
"configuration":{
"type":"object"
},
"custom_scheduling":{
"type":"object"
},
"description":{
"type":"text"
},
"error":{
"type":"keyword"
},
"features":{
"properties":{
"filtering_advanced_config":{
"type":"boolean"
},
"filtering_rules":{
"type":"boolean"
},
"incremental_sync":{
"properties":{
"enabled":{
"type":"boolean"
}
}
},
"sync_rules":{
"properties":{
"advanced":{
"properties":{
"enabled":{
"type":"boolean"
}
}
},
"basic":{
"properties":{
"enabled":{
"type":"boolean"
}
}
}
}
}
}
},
"filtering":{
"properties":{
"active":{
"properties":{
"advanced_snippet":{
"properties":{
"created_at":{
"type":"date"
},
"updated_at":{
"type":"date"
},
"value":{
"type":"object"
}
}
},
"rules":{
"properties":{
"created_at":{
"type":"date"
},
"field":{
"type":"keyword"
},
"id":{
"type":"keyword"
},
"order":{
"type":"short"
},
"policy":{
"type":"keyword"
},
"rule":{
"type":"keyword"
},
"updated_at":{
"type":"date"
},
"value":{
"type":"keyword"
}
}
},
"validation":{
"properties":{
"errors":{
"properties":{
"ids":{
"type":"keyword"
},
"messages":{
"type":"text"
}
}
},
"state":{
"type":"keyword"
}
}
}
}
},
"domain":{
"type":"keyword"
},
"draft":{
"properties":{
"advanced_snippet":{
"properties":{
"created_at":{
"type":"date"
},
"updated_at":{
"type":"date"
},
"value":{
"type":"object"
}
}
},
"rules":{
"properties":{
"created_at":{
"type":"date"
},
"field":{
"type":"keyword"
},
"id":{
"type":"keyword"
},
"order":{
"type":"short"
},
"policy":{
"type":"keyword"
},
"rule":{
"type":"keyword"
},
"updated_at":{
"type":"date"
},
"value":{
"type":"keyword"
}
}
},
"validation":{
"properties":{
"errors":{
"properties":{
"ids":{
"type":"keyword"
},
"messages":{
"type":"text"
}
}
},
"state":{
"type":"keyword"
}
}
}
}
}
}
},
"index_name":{
"type":"keyword"
},
"is_native":{
"type":"boolean"
},
"language":{
"type":"keyword"
},
"last_access_control_sync_error":{
"type":"keyword"
},
"last_access_control_sync_scheduled_at":{
"type":"date"
},
"last_access_control_sync_status":{
"type":"keyword"
},
"last_deleted_document_count":{
"type":"long"
},
"last_incremental_sync_scheduled_at":{
"type":"date"
},
"last_indexed_document_count":{
"type":"long"
},
"last_seen":{
"type":"date"
},
"last_sync_error":{
"type":"keyword"
},
"last_sync_scheduled_at":{
"type":"date"
},
"last_sync_status":{
"type":"keyword"
},
"last_synced":{
"type":"date"
},
"name":{
"type":"keyword"
},
"pipeline":{
"properties":{
"extract_binary_content":{
"type":"boolean"
},
"name":{
"type":"keyword"
},
"reduce_whitespace":{
"type":"boolean"
},
"run_ml_inference":{
"type":"boolean"
}
}
},
"scheduling":{
"properties":{
"access_control":{
"properties":{
"enabled":{
"type":"boolean"
},
"interval":{
"type":"text"
}
}
},
"full":{
"properties":{
"enabled":{
"type":"boolean"
},
"interval":{
"type":"text"
}
}
},
"incremental":{
"properties":{
"enabled":{
"type":"boolean"
},
"interval":{
"type":"text"
}
}
}
}
},
"service_type":{
"type":"keyword"
},
"status":{
"type":"keyword"
},
"sync_cursor":{
"type":"object"
},
"sync_now":{
"type":"boolean"
}
}
}
}
}
2 changes: 2 additions & 0 deletions x-pack/plugin/ent-search/qa/rest/roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ admin:
cluster:
- manage_search_application
- manage_behavioral_analytics
- manage_connector
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment on why this and below permissions are needed? What does it practically mean for users, if it does anything?

- manage
- monitor
indices:
Expand All @@ -18,6 +19,7 @@ user:
cluster:
- post_behavioral_analytics_event
- manage_api_key
- monitor_connector
- read_connector_secrets
- write_connector_secrets
indices:
Expand Down
Loading