Update connector last sync stats API
This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
Updates the fields related to the last sync of a connector.
This action is used for analytics and monitoring.
To get started with Connector APIs, check out our tutorial.
Request
PUT _connector/<connector_id>/_last_sync
Prerequisites
- To sync data using self-managed connectors, you need to deploy the Elastic connector service. on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors.
- The
connector_idparameter should reference an existing connector.
Path parameters
-
<connector_id> - (Required, string)
Request body
-
last_access_control_sync_error - (Optional, string) The last error message related to access control sync, if any.
-
last_access_control_sync_scheduled_at - (Optional, datetime) The datetime indicating when the last access control sync was scheduled.
-
last_access_control_sync_status - (Optional, ConnectorSyncStatus) The status of the last access control sync.
-
last_deleted_document_count - (Optional, long) The number of documents deleted in the last sync process.
-
last_incremental_sync_scheduled_at - (Optional, datetime) The datetime when the last incremental sync was scheduled.
-
last_indexed_document_count - (Optional, long) The number of documents indexed in the last sync.
-
last_sync_error - (Optional, string) The last error message encountered during a sync process, if any.
-
last_sync_scheduled_at - (Optional, datetime) The datetime when the last sync was scheduled.
-
last_sync_status - (Optional, ConnectorSyncStatus) The status of the last sync.
-
last_synced - (Optional, datetime) The datetime of the last successful synchronization.
The value of ConnectorSyncStatus is one of the following lowercase strings representing different sync states:
-
canceling: The sync process is in the process of being canceled. -
canceled: The sync process has been canceled. -
completed: The sync process completed successfully. -
error: An error occurred during the sync process. -
in_progress: The sync process is currently underway. -
pending: The sync is pending and has not yet started. -
suspended: The sync process has been temporarily suspended.
Response codes
-
200 - Connector last sync stats were successfully updated.
-
400 - The
connector_idwas not provided or the request payload was malformed. -
404(Missing resources) - No connector matching
connector_idcould be found.
Examples
The following example updates the last sync stats for the connector with ID my-connector:
resp = client.connector.last_sync(
connector_id="my-connector",
last_access_control_sync_error="Houston, we have a problem!",
last_access_control_sync_scheduled_at="2023-11-09T15:13:08.231Z",
last_access_control_sync_status="pending",
last_deleted_document_count=42,
last_incremental_sync_scheduled_at="2023-11-09T15:13:08.231Z",
last_indexed_document_count=42,
last_sync_error="Houston, we have a problem!",
last_sync_scheduled_at="2024-11-09T15:13:08.231Z",
last_sync_status="completed",
last_synced="2024-11-09T15:13:08.231Z",
)
print(resp) response = client.connector.last_sync(
connector_id: 'my-connector',
body: {
last_access_control_sync_error: 'Houston, we have a problem!',
last_access_control_sync_scheduled_at: '2023-11-09T15:13:08.231Z',
last_access_control_sync_status: 'pending',
last_deleted_document_count: 42,
last_incremental_sync_scheduled_at: '2023-11-09T15:13:08.231Z',
last_indexed_document_count: 42,
last_sync_error: 'Houston, we have a problem!',
last_sync_scheduled_at: '2024-11-09T15:13:08.231Z',
last_sync_status: 'completed',
last_synced: '2024-11-09T15:13:08.231Z'
}
)
puts response const response = await client.connector.lastSync({
connector_id: "my-connector",
last_access_control_sync_error: "Houston, we have a problem!",
last_access_control_sync_scheduled_at: "2023-11-09T15:13:08.231Z",
last_access_control_sync_status: "pending",
last_deleted_document_count: 42,
last_incremental_sync_scheduled_at: "2023-11-09T15:13:08.231Z",
last_indexed_document_count: 42,
last_sync_error: "Houston, we have a problem!",
last_sync_scheduled_at: "2024-11-09T15:13:08.231Z",
last_sync_status: "completed",
last_synced: "2024-11-09T15:13:08.231Z",
});
console.log(response); PUT _connector/my-connector/_last_sync
{
"last_access_control_sync_error": "Houston, we have a problem!",
"last_access_control_sync_scheduled_at": "2023-11-09T15:13:08.231Z",
"last_access_control_sync_status": "pending",
"last_deleted_document_count": 42,
"last_incremental_sync_scheduled_at": "2023-11-09T15:13:08.231Z",
"last_indexed_document_count": 42,
"last_sync_error": "Houston, we have a problem!",
"last_sync_scheduled_at": "2024-11-09T15:13:08.231Z",
"last_sync_status": "completed",
"last_synced": "2024-11-09T15:13:08.231Z"
} {
"result": "updated"
}
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/update-connector-last-sync-api.html