update-connector-last-sync-api.asciidoc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. [[update-connector-last-sync-api]]
  2. === Update connector last sync stats API
  3. ++++
  4. <titleabbrev>Update connector last sync stats</titleabbrev>
  5. ++++
  6. preview::[]
  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. Updates the fields related to the last sync of a connector.
  13. This action is used for analytics and monitoring.
  14. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  15. [[update-connector-last-sync-api-request]]
  16. ==== {api-request-title}
  17. `PUT _connector/<connector_id>/_last_sync`
  18. [[update-connector-last-sync-api-prereq]]
  19. ==== {api-prereq-title}
  20. * 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.
  21. * The `connector_id` parameter should reference an existing connector.
  22. [[update-connector-last-sync-api-path-params]]
  23. ==== {api-path-parms-title}
  24. `<connector_id>`::
  25. (Required, string)
  26. [role="child_attributes"]
  27. [[update-connector-last-sync-api-request-body]]
  28. ==== {api-request-body-title}
  29. `last_access_control_sync_error`::
  30. (Optional, string) The last error message related to access control sync, if any.
  31. `last_access_control_sync_scheduled_at`::
  32. (Optional, datetime) The datetime indicating when the last access control sync was scheduled.
  33. `last_access_control_sync_status`::
  34. (Optional, ConnectorSyncStatus) The status of the last access control sync.
  35. `last_deleted_document_count`::
  36. (Optional, long) The number of documents deleted in the last sync process.
  37. `last_incremental_sync_scheduled_at`::
  38. (Optional, datetime) The datetime when the last incremental sync was scheduled.
  39. `last_indexed_document_count`::
  40. (Optional, long) The number of documents indexed in the last sync.
  41. `last_sync_error`::
  42. (Optional, string) The last error message encountered during a sync process, if any.
  43. `last_sync_scheduled_at`::
  44. (Optional, datetime) The datetime when the last sync was scheduled.
  45. `last_sync_status`::
  46. (Optional, ConnectorSyncStatus) The status of the last sync.
  47. `last_synced`::
  48. (Optional, datetime) The datetime of the last successful synchronization.
  49. The value of `ConnectorSyncStatus` is one of the following lowercase strings representing different sync states:
  50. * `canceling`: The sync process is in the process of being canceled.
  51. * `canceled`: The sync process has been canceled.
  52. * `completed`: The sync process completed successfully.
  53. * `error`: An error occurred during the sync process.
  54. * `in_progress`: The sync process is currently underway.
  55. * `pending`: The sync is pending and has not yet started.
  56. * `suspended`: The sync process has been temporarily suspended.
  57. [[update-connector-last-sync-api-response-codes]]
  58. ==== {api-response-codes-title}
  59. `200`::
  60. Connector last sync stats were successfully updated.
  61. `400`::
  62. The `connector_id` was not provided or the request payload was malformed.
  63. `404` (Missing resources)::
  64. No connector matching `connector_id` could be found.
  65. [[update-connector-last-sync-api-example]]
  66. ==== {api-examples-title}
  67. The following example updates the last sync stats for the connector with ID `my-connector`:
  68. ////
  69. [source, console]
  70. --------------------------------------------------
  71. PUT _connector/my-connector
  72. {
  73. "index_name": "search-google-drive",
  74. "name": "My Connector",
  75. "service_type": "google_drive"
  76. }
  77. --------------------------------------------------
  78. // TESTSETUP
  79. [source,console]
  80. --------------------------------------------------
  81. DELETE _connector/my-connector
  82. --------------------------------------------------
  83. // TEARDOWN
  84. ////
  85. [source,console]
  86. ----
  87. PUT _connector/my-connector/_last_sync
  88. {
  89. "last_access_control_sync_error": "Houston, we have a problem!",
  90. "last_access_control_sync_scheduled_at": "2023-11-09T15:13:08.231Z",
  91. "last_access_control_sync_status": "pending",
  92. "last_deleted_document_count": 42,
  93. "last_incremental_sync_scheduled_at": "2023-11-09T15:13:08.231Z",
  94. "last_indexed_document_count": 42,
  95. "last_sync_error": "Houston, we have a problem!",
  96. "last_sync_scheduled_at": "2024-11-09T15:13:08.231Z",
  97. "last_sync_status": "completed",
  98. "last_synced": "2024-11-09T15:13:08.231Z"
  99. }
  100. ----
  101. [source,console-result]
  102. ----
  103. {
  104. "result": "updated"
  105. }
  106. ----