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

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