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

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