set-connector-sync-job-stats-api.asciidoc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. [[set-connector-sync-job-stats-api]]
  2. === Set connector sync job stats API
  3. ++++
  4. <titleabbrev>Set connector sync job stats</titleabbrev>
  5. ++++
  6. Sets connector sync job stats.
  7. [[set-connector-sync-job-stats-api-request]]
  8. ==== {api-request-title}
  9. `PUT _connector/_sync_job/<connector_sync_job_id>/_stats`
  10. [[set-connector-sync-job-stats-api-prereqs]]
  11. ==== {api-prereq-title}
  12. * To sync data using connectors, it's essential to have the Elastic connectors service running.
  13. * The `connector_sync_job_id` parameter should reference an existing connector sync job.
  14. [[set-connector-sync-job-stats-api-desc]]
  15. ==== {api-description-title}
  16. Sets the stats for a connector sync job.
  17. Stats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume` and `total_document_count`.
  18. `last_seen` can also be updated using this API.
  19. This API is mainly used by the connector service for updating sync job information.
  20. [[set-connector-sync-job-stats-api-path-params]]
  21. ==== {api-path-parms-title}
  22. `<connector_sync_job_id>`::
  23. (Required, string)
  24. [role="child_attributes"]
  25. [[set-connector-sync-job-stats-api-request-body]]
  26. ==== {api-request-body-title}
  27. `deleted_document_count`::
  28. (Required, int) The number of documents the sync job deleted.
  29. `indexed_document_count`::
  30. (Required, int) The number of documents the sync job indexed.
  31. `indexed_document_volume`::
  32. (Required, int) The total size of the data (in MiB) the sync job indexed.
  33. `total_document_count`::
  34. (Optional, int) The total number of documents in the target index after the sync job finished.
  35. `last_seen`::
  36. (Optional, instant) The timestamp to set the connector sync job's `last_seen` property.
  37. [[set-connector-sync-job-stats-api-response-codes]]
  38. ==== {api-response-codes-title}
  39. `200`::
  40. Indicates that the connector sync job stats were successfully updated.
  41. `404`::
  42. No connector sync job matching `connector_sync_job_id` could be found.
  43. [[set-connector-sync-job-stats-api-example]]
  44. ==== {api-examples-title}
  45. The following example sets all mandatory and optional stats for the connector sync job `my-connector-sync-job`:
  46. [source,console]
  47. ----
  48. PUT _connector/_sync_job/my-connector-sync-job/_stats
  49. {
  50. "deleted_document_count": 10,
  51. "indexed_document_count": 20,
  52. "indexed_document_volume": 1000,
  53. "total_document_count": 2000,
  54. "last_seen": "2023-01-02T10:00:00Z"
  55. }
  56. ----
  57. // TEST[skip:there's no way to clean up after creating a connector sync job, as we don't know the id ahead of time. Therefore, skip this test.]