update-connector-features-api.asciidoc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. [[update-connector-features-api]]
  2. === Update connector features API
  3. ++++
  4. <titleabbrev>Update connector features</titleabbrev>
  5. ++++
  6. beta::[]
  7. ..New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-connector[Connector APIs].
  11. --
  12. Manages the `features` of a connector. This endpoint can be used to control the following aspects of a connector:
  13. * document-level security
  14. * incremental syncs
  15. * advanced sync rules
  16. * basic sync rules
  17. Normally, the running connector service automatically manages these features. However, you can use this API to override the default behavior.
  18. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  19. [[update-connector-features-api-request]]
  20. ==== {api-request-title}
  21. `PUT _connector/<connector_id>/_features`
  22. [[update-connector-features-api-prereq]]
  23. ==== {api-prereq-title}
  24. * 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.
  25. * The `connector_id` parameter should reference an existing connector.
  26. [[update-connector-features-api-path-params]]
  27. ==== {api-path-parms-title}
  28. `<connector_id>`::
  29. (Required, string)
  30. [role="child_attributes"]
  31. [[update-connector-features-api-request-body]]
  32. ==== {api-request-body-title}
  33. `features`::
  34. (Required, object) An object containing connector features.
  35. * `document_level_security` (Optional, object) Controls whether document-level security is enabled with the `enabled` flag.
  36. * `incremental_sync` (Optional, object) Controls whether incremental syncs are enabled with the `enabled` flag.
  37. * `native_connector_api_keys`(Optional, object) Controls whether managed connector API keys are enabled with the `enabled` flag.
  38. * `sync_rules` (Optional, object) Controls sync rules.
  39. ** `advanced` (Optional, object) Controls whether advanced sync rules are enabled with the `enabled` flag.
  40. ** `basic`(Optional, object) Controls whether basic sync rules are enabled with the `enabled` flag.
  41. [[update-connector-features-api-response-codes]]
  42. ==== {api-response-codes-title}
  43. `200`::
  44. Connector `features` was successfully updated.
  45. `400`::
  46. The `connector_id` was not provided or the request payload was malformed.
  47. `404` (Missing resources)::
  48. No connector matching `connector_id` could be found.
  49. [[update-connector-features-api-example]]
  50. ==== {api-examples-title}
  51. The following example updates the `features` field for the connector with ID `my-connector`:
  52. ////
  53. [source, console]
  54. --------------------------------------------------
  55. PUT _connector/my-connector
  56. {
  57. "index_name": "search-google-drive",
  58. "name": "My Connector",
  59. "service_type": "google_drive"
  60. }
  61. --------------------------------------------------
  62. // TESTSETUP
  63. [source,console]
  64. --------------------------------------------------
  65. DELETE _connector/my-connector
  66. --------------------------------------------------
  67. // TEARDOWN
  68. ////
  69. [source,console]
  70. ----
  71. PUT _connector/my-connector/_features
  72. {
  73. "features": {
  74. "document_level_security": {
  75. "enabled": true
  76. },
  77. "incremental_sync": {
  78. "enabled": true
  79. },
  80. "sync_rules": {
  81. "advanced": {
  82. "enabled": false
  83. },
  84. "basic": {
  85. "enabled": true
  86. }
  87. }
  88. }
  89. }
  90. ----
  91. [source,console-result]
  92. ----
  93. {
  94. "result": "updated"
  95. }
  96. ----
  97. 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:
  98. [source,console]
  99. ----
  100. PUT _connector/my-connector/_features
  101. {
  102. "features": {
  103. "document_level_security": {
  104. "enabled": true
  105. }
  106. }
  107. }
  108. ----
  109. [source,console-result]
  110. ----
  111. {
  112. "result": "updated"
  113. }
  114. ----