elasticsearch/docs/reference/connector/apis/update-connector-features-api.asciidoc
2024-12-31 20:21:46 +00:00

145 lines
3.7 KiB
Text

[[update-connector-features-api]]
=== Update connector features API
++++
<titleabbrev>Update connector features</titleabbrev>
++++
beta::[]
.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-connector[Connector APIs].
--
Manages the `features` of a connector. This endpoint can be used to control the following aspects of a connector:
* document-level security
* incremental syncs
* advanced sync rules
* basic sync rules
Normally, the running connector service automatically manages these features. However, you can use this API to override the default behavior.
To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
[[update-connector-features-api-request]]
==== {api-request-title}
`PUT _connector/<connector_id>/_features`
[[update-connector-features-api-prereq]]
==== {api-prereq-title}
* To sync data using self-managed connectors, you need to deploy the <<es-connectors-deploy-connector-service,Elastic connector service>>. on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors.
* The `connector_id` parameter should reference an existing connector.
[[update-connector-features-api-path-params]]
==== {api-path-parms-title}
`<connector_id>`::
(Required, string)
[role="child_attributes"]
[[update-connector-features-api-request-body]]
==== {api-request-body-title}
`features`::
(Required, object) An object containing connector features.
* `document_level_security` (Optional, object) Controls whether document-level security is enabled with the `enabled` flag.
* `incremental_sync` (Optional, object) Controls whether incremental syncs are enabled with the `enabled` flag.
* `native_connector_api_keys`(Optional, object) Controls whether managed connector API keys are enabled with the `enabled` flag.
* `sync_rules` (Optional, object) Controls sync rules.
** `advanced` (Optional, object) Controls whether advanced sync rules are enabled with the `enabled` flag.
** `basic`(Optional, object) Controls whether basic sync rules are enabled with the `enabled` flag.
[[update-connector-features-api-response-codes]]
==== {api-response-codes-title}
`200`::
Connector `features` was successfully updated.
`400`::
The `connector_id` was not provided or the request payload was malformed.
`404` (Missing resources)::
No connector matching `connector_id` could be found.
[[update-connector-features-api-example]]
==== {api-examples-title}
The following example updates the `features` field for the connector with ID `my-connector`:
////
[source, console]
--------------------------------------------------
PUT _connector/my-connector
{
"index_name": "search-google-drive",
"name": "My Connector",
"service_type": "google_drive"
}
--------------------------------------------------
// TESTSETUP
[source,console]
--------------------------------------------------
DELETE _connector/my-connector
--------------------------------------------------
// TEARDOWN
////
[source,console]
----
PUT _connector/my-connector/_features
{
"features": {
"document_level_security": {
"enabled": true
},
"incremental_sync": {
"enabled": true
},
"sync_rules": {
"advanced": {
"enabled": false
},
"basic": {
"enabled": true
}
}
}
}
----
[source,console-result]
----
{
"result": "updated"
}
----
The endpoint supports partial updates of the `features` field. For example, to update only the `document_level_security` feature, you can send the following request:
[source,console]
----
PUT _connector/my-connector/_features
{
"features": {
"document_level_security": {
"enabled": true
}
}
}
----
[source,console-result]
----
{
"result": "updated"
}
----