Set connector sync job 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.
Sets connector sync job stats.
To get started with Connector APIs, check out our tutorial.
Request
PUT _connector/_sync_job/<connector_sync_job_id>/_stats
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_sync_job_idparameter should reference an existing connector sync job.
Description
Sets the stats for a connector sync job. Stats include: deleted_document_count, indexed_document_count, indexed_document_volume and total_document_count. last_seen can also be updated using this API. This API is mainly used by the connector service for updating sync job information.
Path parameters
-
<connector_sync_job_id> - (Required, string)
Request body
-
deleted_document_count - (Required, int) The number of documents the sync job deleted.
-
indexed_document_count - (Required, int) The number of documents the sync job indexed.
-
indexed_document_volume - (Required, int) The total size of the data (in MiB) the sync job indexed.
-
total_document_count - (Optional, int) The total number of documents in the target index after the sync job finished.
-
last_seen - (Optional, instant) The timestamp to set the connector sync job’s
last_seenproperty. -
metadata - (Optional, object) The connector-specific metadata.
Response codes
-
200 - Indicates that the connector sync job stats were successfully updated.
-
404 - No connector sync job matching
connector_sync_job_idcould be found.
Examples
The following example sets all mandatory and optional stats for the connector sync job my-connector-sync-job:
resp = client.perform_request(
"PUT",
"/_connector/_sync_job/my-connector-sync-job/_stats",
headers={"Content-Type": "application/json"},
body={
"deleted_document_count": 10,
"indexed_document_count": 20,
"indexed_document_volume": 1000,
"total_document_count": 2000,
"last_seen": "2023-01-02T10:00:00Z"
},
)
print(resp) response = client.connector.sync_job_update_stats(
connector_sync_job_id: 'my-connector-sync-job',
body: {
deleted_document_count: 10,
indexed_document_count: 20,
indexed_document_volume: 1000,
total_document_count: 2000,
last_seen: '2023-01-02T10:00:00Z'
}
)
puts response const response = await client.transport.request({
method: "PUT",
path: "/_connector/_sync_job/my-connector-sync-job/_stats",
body: {
deleted_document_count: 10,
indexed_document_count: 20,
indexed_document_volume: 1000,
total_document_count: 2000,
last_seen: "2023-01-02T10:00:00Z",
},
});
console.log(response); PUT _connector/_sync_job/my-connector-sync-job/_stats
{
"deleted_document_count": 10,
"indexed_document_count": 20,
"indexed_document_volume": 1000,
"total_document_count": 2000,
"last_seen": "2023-01-02T10:00:00Z"
}
© 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/set-connector-sync-job-stats-api.html