IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Update connector last sync stats API
editUpdate connector last sync stats API
editThis 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
editPUT _connector/<connector_id>/_last_sync
Prerequisites
edit- 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_id
parameter should reference an existing connector.
Path parameters
edit-
<connector_id>
- (Required, string)
Request body
edit-
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
edit-
200
- Connector last sync stats were successfully updated.
-
400
-
The
connector_id
was not provided or the request payload was malformed. -
404
(Missing resources) -
No connector matching
connector_id
could be found.
Examples
editThe 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" }