@@ -996,6 +996,106 @@ async def sync_job_post(
996996 path_parts = __path_parts ,
997997 )
998998
999+ @_rewrite_parameters (
1000+ body_fields = (
1001+ "deleted_document_count" ,
1002+ "indexed_document_count" ,
1003+ "indexed_document_volume" ,
1004+ "last_seen" ,
1005+ "metadata" ,
1006+ "total_document_count" ,
1007+ ),
1008+ )
1009+ @_stability_warning (Stability .EXPERIMENTAL )
1010+ async def sync_job_update_stats (
1011+ self ,
1012+ * ,
1013+ connector_sync_job_id : str ,
1014+ deleted_document_count : t .Optional [int ] = None ,
1015+ indexed_document_count : t .Optional [int ] = None ,
1016+ indexed_document_volume : t .Optional [int ] = None ,
1017+ error_trace : t .Optional [bool ] = None ,
1018+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
1019+ human : t .Optional [bool ] = None ,
1020+ last_seen : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
1021+ metadata : t .Optional [t .Mapping [str , t .Any ]] = None ,
1022+ pretty : t .Optional [bool ] = None ,
1023+ total_document_count : t .Optional [int ] = None ,
1024+ body : t .Optional [t .Dict [str , t .Any ]] = None ,
1025+ ) -> ObjectApiResponse [t .Any ]:
1026+ """
1027+ Set the connector sync job stats. Stats include: `deleted_document_count`, `indexed_document_count`,
1028+ `indexed_document_volume`, and `total_document_count`. You can also update `last_seen`.
1029+ This API is mainly used by the connector service for updating sync job information.
1030+ To sync data using self-managed connectors, you need to deploy the Elastic connector
1031+ service on your own infrastructure. This service runs automatically on Elastic
1032+ Cloud for Elastic managed connectors.
1033+
1034+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/set-connector-sync-job-stats-api.html>`_
1035+
1036+ :param connector_sync_job_id: The unique identifier of the connector sync job.
1037+ :param deleted_document_count: The number of documents the sync job deleted.
1038+ :param indexed_document_count: The number of documents the sync job indexed.
1039+ :param indexed_document_volume: The total size of the data (in MiB) the sync
1040+ job indexed.
1041+ :param last_seen: The timestamp to use in the `last_seen` property for the connector
1042+ sync job.
1043+ :param metadata: The connector-specific metadata.
1044+ :param total_document_count: The total number of documents in the target index
1045+ after the sync job finished.
1046+ """
1047+ if connector_sync_job_id in SKIP_IN_PATH :
1048+ raise ValueError ("Empty value passed for parameter 'connector_sync_job_id'" )
1049+ if deleted_document_count is None and body is None :
1050+ raise ValueError (
1051+ "Empty value passed for parameter 'deleted_document_count'"
1052+ )
1053+ if indexed_document_count is None and body is None :
1054+ raise ValueError (
1055+ "Empty value passed for parameter 'indexed_document_count'"
1056+ )
1057+ if indexed_document_volume is None and body is None :
1058+ raise ValueError (
1059+ "Empty value passed for parameter 'indexed_document_volume'"
1060+ )
1061+ __path_parts : t .Dict [str , str ] = {
1062+ "connector_sync_job_id" : _quote (connector_sync_job_id )
1063+ }
1064+ __path = f'/_connector/_sync_job/{ __path_parts ["connector_sync_job_id" ]} /_stats'
1065+ __query : t .Dict [str , t .Any ] = {}
1066+ __body : t .Dict [str , t .Any ] = body if body is not None else {}
1067+ if error_trace is not None :
1068+ __query ["error_trace" ] = error_trace
1069+ if filter_path is not None :
1070+ __query ["filter_path" ] = filter_path
1071+ if human is not None :
1072+ __query ["human" ] = human
1073+ if pretty is not None :
1074+ __query ["pretty" ] = pretty
1075+ if not __body :
1076+ if deleted_document_count is not None :
1077+ __body ["deleted_document_count" ] = deleted_document_count
1078+ if indexed_document_count is not None :
1079+ __body ["indexed_document_count" ] = indexed_document_count
1080+ if indexed_document_volume is not None :
1081+ __body ["indexed_document_volume" ] = indexed_document_volume
1082+ if last_seen is not None :
1083+ __body ["last_seen" ] = last_seen
1084+ if metadata is not None :
1085+ __body ["metadata" ] = metadata
1086+ if total_document_count is not None :
1087+ __body ["total_document_count" ] = total_document_count
1088+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
1089+ return await self .perform_request ( # type: ignore[return-value]
1090+ "PUT" ,
1091+ __path ,
1092+ params = __query ,
1093+ headers = __headers ,
1094+ body = __body ,
1095+ endpoint_id = "connector.sync_job_update_stats" ,
1096+ path_parts = __path_parts ,
1097+ )
1098+
9991099 @_rewrite_parameters ()
10001100 @_stability_warning (Stability .EXPERIMENTAL )
10011101 async def update_active_filtering (
0 commit comments