update-connector-scheduling-api.asciidoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. [[update-connector-scheduling-api]]
  2. === Update connector scheduling API
  3. ++++
  4. <titleabbrev>Update connector scheduling</titleabbrev>
  5. ++++
  6. beta::[]
  7. Updates the `scheduling` configuration of a connector.
  8. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  9. [[update-connector-scheduling-api-request]]
  10. ==== {api-request-title}
  11. `PUT _connector/<connector_id>/_scheduling`
  12. [[update-connector-scheduling-api-prereq]]
  13. ==== {api-prereq-title}
  14. * 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.
  15. * The `connector_id` parameter should reference an existing connector.
  16. [[update-connector-scheduling-api-path-params]]
  17. ==== {api-path-parms-title}
  18. `<connector_id>`::
  19. (Required, string)
  20. [role="child_attributes"]
  21. [[update-connector-scheduling-api-request-body]]
  22. ==== {api-request-body-title}
  23. `scheduling`::
  24. (Required, object) The scheduling configuration for the connector. This configuration determines frequency of synchronization operations for the connector.
  25. The scheduling configuration includes the following attributes, each represented as a `ScheduleConfig` object. If the `scheduling` object does not include all schedule types, only those provided will be updated; the others will remain unchanged.
  26. - `access_control` (Optional, `ScheduleConfig` object) Defines the schedule for synchronizing access control settings of the connector.
  27. - `full` (Optional, `ScheduleConfig` object) Defines the schedule for a full content syncs.
  28. - `incremental` (Optional, `ScheduleConfig` object) Defines the schedule for incremental content syncs.
  29. Each `ScheduleConfig` object includes the following sub-attributes:
  30. - `enabled` (Required, boolean) A flag that enables or disables the scheduling.
  31. - `interval` (Required, string) A CRON expression representing the sync schedule. This expression defines the grequency at which the sync operations should occur. It must be provided in a valid CRON format.
  32. [[update-connector-scheduling-api-response-codes]]
  33. ==== {api-response-codes-title}
  34. `200`::
  35. Connector `scheduling` field was successfully updated.
  36. `400`::
  37. The `connector_id` was not provided or the request payload was malformed.
  38. `404` (Missing resources)::
  39. No connector matching `connector_id` could be found.
  40. [[update-connector-scheduling-api-example]]
  41. ==== {api-examples-title}
  42. The following example updates the `scheduling` property for the connector with ID `my-connector`:
  43. ////
  44. [source, console]
  45. --------------------------------------------------
  46. PUT _connector/my-connector
  47. {
  48. "index_name": "search-google-drive",
  49. "name": "My Connector",
  50. "service_type": "google_drive"
  51. }
  52. --------------------------------------------------
  53. // TESTSETUP
  54. [source,console]
  55. --------------------------------------------------
  56. DELETE _connector/my-connector
  57. --------------------------------------------------
  58. // TEARDOWN
  59. ////
  60. [source,console]
  61. ----
  62. PUT _connector/my-connector/_scheduling
  63. {
  64. "scheduling": {
  65. "access_control": {
  66. "enabled": true,
  67. "interval": "0 10 0 * * ?"
  68. },
  69. "full": {
  70. "enabled": true,
  71. "interval": "0 20 0 * * ?"
  72. },
  73. "incremental": {
  74. "enabled": false,
  75. "interval": "0 30 0 * * ?"
  76. }
  77. }
  78. }
  79. ----
  80. [source,console-result]
  81. ----
  82. {
  83. "result": "updated"
  84. }
  85. ----
  86. The following example updates `full` sync schedule only, other schedule types remain unchanged:
  87. [source,console]
  88. ----
  89. PUT _connector/my-connector/_scheduling
  90. {
  91. "scheduling": {
  92. "full": {
  93. "enabled": true,
  94. "interval": "0 10 0 * * ?"
  95. }
  96. }
  97. }
  98. ----
  99. [source,console-result]
  100. ----
  101. {
  102. "result": "updated"
  103. }
  104. ----