From a5e1906ee58347939df36b02c62d7aee713f3107 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Tue, 7 Jan 2025 05:19:31 -0800 Subject: [PATCH] Add specification for set connector sync job stats (#3368) * Add specification for set connector sync job stats * fix conflicts * restore old changes --------- Co-authored-by: Laura Trotta (cherry picked from commit ea0411c044b6a44ee95a3a03527894777dc882c1) --- output/openapi/elasticsearch-openapi.json | 75 ++++++++++ output/schema/schema.json | 137 +++++++++++++++++- output/schema/validation-errors.json | 6 - output/typescript/types.ts | 15 ++ specification/_doc_ids/table.csv | 1 + .../SyncJobUpdateStatsRequest.ts | 72 +++++++++ .../SyncJobUpdateStatsResponse.ts | 22 +++ 7 files changed, 318 insertions(+), 10 deletions(-) create mode 100644 specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts create mode 100644 specification/connector/sync_job_update_stats/SyncJobUpdateStatsResponse.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 882931ae5d..655c27aaac 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -5324,6 +5324,81 @@ "x-beta": true } }, + "/_connector/_sync_job/{connector_sync_job_id}/_stats": { + "put": { + "tags": [ + "connector" + ], + "summary": "Set the connector sync job stats", + "description": "Stats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume`, and `total_document_count`.\nYou can also update `last_seen`.\nThis API is mainly used by the connector service for updating sync job information.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", + "operationId": "connector-sync-job-update-stats", + "parameters": [ + { + "in": "path", + "name": "connector_sync_job_id", + "description": "The unique identifier of the connector sync job.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Id" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "deleted_document_count": { + "description": "The number of documents the sync job deleted.", + "type": "number" + }, + "indexed_document_count": { + "description": "The number of documents the sync job indexed.", + "type": "number" + }, + "indexed_document_volume": { + "description": "The total size of the data (in MiB) the sync job indexed.", + "type": "number" + }, + "last_seen": { + "$ref": "#/components/schemas/_types:Duration" + }, + "metadata": { + "$ref": "#/components/schemas/_types:Metadata" + }, + "total_document_count": { + "description": "The total number of documents in the target index after the sync job finished.", + "type": "number" + } + }, + "required": [ + "deleted_document_count", + "indexed_document_count", + "indexed_document_volume" + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-state": "Technical preview" + } + }, "/_connector/{connector_id}/_filtering/_activate": { "put": { "tags": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index b0de7095eb..afc883a37f 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -3571,15 +3571,22 @@ "visibility": "public" } }, - "description": "Updates the stats fields in the connector sync job document.", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/set-connector-sync-job-stats-api.html", + "description": "Set the connector sync job stats.\nStats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume`, and `total_document_count`.\nYou can also update `last_seen`.\nThis API is mainly used by the connector service for updating sync job information.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", + "docId": "connector-sync-job-stats", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/set-connector-sync-job-stats-api.html", "name": "connector.sync_job_update_stats", - "request": null, + "request": { + "name": "Request", + "namespace": "connector.sync_job_update_stats" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "connector.sync_job_update_stats" + }, "responseMediaType": [ "application/json" ], @@ -116388,6 +116395,128 @@ }, "specLocation": "connector/sync_job_post/SyncJobPostResponse.ts#L22-L26" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "The number of documents the sync job deleted.", + "name": "deleted_document_count", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "description": "The number of documents the sync job indexed.", + "name": "indexed_document_count", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "description": "The total size of the data (in MiB) the sync job indexed.", + "name": "indexed_document_volume", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "description": "The timestamp to use in the `last_seen` property for the connector sync job.", + "name": "last_seen", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The connector-specific metadata.", + "name": "metadata", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Metadata", + "namespace": "_types" + } + } + }, + { + "description": "The total number of documents in the target index after the sync job finished.", + "name": "total_document_count", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + } + ] + }, + "description": "Set the connector sync job stats.\nStats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume`, and `total_document_count`.\nYou can also update `last_seen`.\nThis API is mainly used by the connector service for updating sync job information.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "connector.sync_job_update_stats" + }, + "path": [ + { + "description": "The unique identifier of the connector sync job.", + "name": "connector_sync_job_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "query": [], + "specLocation": "connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts#L24-L72" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [] + }, + "name": { + "name": "Response", + "namespace": "connector.sync_job_update_stats" + }, + "specLocation": "connector/sync_job_update_stats/SyncJobUpdateStatsResponse.ts#L20-L22" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 5df44cf6b5..7a8c07e4f5 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -355,12 +355,6 @@ ], "response": [] }, - "connector.sync_job_update_stats": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "enrich.delete_policy": { "request": [ "Request: missing json spec query parameter 'master_timeout'" diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 7beaf0f86a..2d8b31975b 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10076,6 +10076,21 @@ export interface ConnectorSyncJobPostResponse { id: Id } +export interface ConnectorSyncJobUpdateStatsRequest extends RequestBase { + connector_sync_job_id: Id + body?: { + deleted_document_count: long + indexed_document_count: long + indexed_document_volume: long + last_seen?: Duration + metadata?: Metadata + total_document_count?: integer + } +} + +export interface ConnectorSyncJobUpdateStatsResponse { +} + export interface ConnectorUpdateActiveFilteringRequest extends RequestBase { connector_id: Id } diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 907a170207..63e512d7ac 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -96,6 +96,7 @@ connector-sync-job-delete,https://www.elastic.co/guide/en/elasticsearch/referenc connector-sync-job-get,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-connector-sync-job-api.html connector-sync-job-post,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/create-connector-sync-job-api.html connector-sync-job-list,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/list-connector-sync-jobs-api.html +connector-sync-job-stats,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/set-connector-sync-job-stats-api.html connector-checkin,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/check-in-connector-api.html connector-delete,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-connector-api.html connector-features,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/update-connector-features-api.html diff --git a/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts b/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts new file mode 100644 index 0000000000..ac64759f35 --- /dev/null +++ b/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts @@ -0,0 +1,72 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { RequestBase } from '@_types/Base' +import { Id, Metadata } from '@_types/common' +import { integer, long } from '@_types/Numeric' +import { Duration } from '@_types/Time' + +/** + * Set the connector sync job stats. + * Stats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume`, and `total_document_count`. + * You can also update `last_seen`. + * This API is mainly used by the connector service for updating sync job information. + * + * 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. + * @rest_spec_name connector.sync_job_update_stats + * @availability stack stability=experimental visibility=public + * @doc_id connector-sync-job-stats + */ +export interface Request extends RequestBase { + /** + * The sync job to be created + */ + path_parts: { + /** + * The unique identifier of the connector sync job. + */ + connector_sync_job_id: Id + } + body: { + /** + * The number of documents the sync job deleted. + */ + deleted_document_count: long + /** + * The number of documents the sync job indexed. + */ + indexed_document_count: long + /** + * The total size of the data (in MiB) the sync job indexed. + */ + indexed_document_volume: long + /** + * The timestamp to use in the `last_seen` property for the connector sync job. + */ + last_seen?: Duration + /** + * The connector-specific metadata. + */ + metadata?: Metadata + /** + * The total number of documents in the target index after the sync job finished. + */ + total_document_count?: integer + } +} diff --git a/specification/connector/sync_job_update_stats/SyncJobUpdateStatsResponse.ts b/specification/connector/sync_job_update_stats/SyncJobUpdateStatsResponse.ts new file mode 100644 index 0000000000..0769bf66cb --- /dev/null +++ b/specification/connector/sync_job_update_stats/SyncJobUpdateStatsResponse.ts @@ -0,0 +1,22 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export class Response { + body: {} +}