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

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