From e747641bc0e9973f2d5bd79ea86c4bf4258a0bd5 Mon Sep 17 00:00:00 2001 From: lcawl Date: Wed, 18 Dec 2024 18:00:43 -0800 Subject: [PATCH 1/3] Add specification for set connector sync job stats --- output/openapi/elasticsearch-openapi.json | 80 ++++++++++ output/schema/schema.json | 144 +++++++++++++++++- output/typescript/types.ts | 15 ++ specification/_doc_ids/table.csv | 1 + .../SyncJobUpdateStatsRequest.ts | 73 +++++++++ .../SyncJobUpdateStatsResponse.ts | 22 +++ 6 files changed, 331 insertions(+), 4 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 e29904ffe0..610cad2ed2 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -5312,6 +5312,86 @@ "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": { + "description": "The timestamp to use in the `last_seen` property for the connector sync job.", + "type": "number" + }, + "metadata": { + "description": "The connector-specific metadata.", + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "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 8724aa9593..06c1bfd5c1 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" ], @@ -116419,6 +116426,135 @@ }, "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": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The number of documents the sync job indexed.", + "name": "indexed_document_count", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "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": "integer", + "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": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The connector-specific metadata.", + "name": "metadata", + "required": false, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "singleKey": false, + "value": { + "kind": "user_defined_value" + } + } + }, + { + "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#L25-L73" + }, + { + "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/typescript/types.ts b/output/typescript/types.ts index e67511c3e7..d99a47dc1c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10083,6 +10083,21 @@ export interface ConnectorSyncJobPostResponse { id: Id } +export interface ConnectorSyncJobUpdateStatsRequest extends RequestBase { + connector_sync_job_id: Id + body?: { + deleted_document_count: integer + indexed_document_count: integer + indexed_document_volume: integer + last_seen?: integer + metadata?: Record + 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..9e34447aa7 --- /dev/null +++ b/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts @@ -0,0 +1,73 @@ +/* + * 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 { Dictionary } from '@spec_utils/Dictionary' +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' +import { RequestBase } from '@_types/Base' +import { Id } from '@_types/common' +import { integer } from '@_types/Numeric' + +/** + * 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: integer + /** + * The number of documents the sync job indexed. + */ + indexed_document_count: integer + /** + * The total size of the data (in MiB) the sync job indexed. + */ + indexed_document_volume: integer + /** + * The timestamp to use in the `last_seen` property for the connector sync job. + */ + last_seen?: integer + /** + * The connector-specific metadata. + */ + metadata?: Dictionary + /** + * 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: {} +} From e126eab1cb72447da624c8d25c19e0de1fede681 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 7 Jan 2025 13:47:29 +0100 Subject: [PATCH 2/3] fix conflicts --- output/schema/validation-errors.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 3b2613f018..5d10c486de 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -243,12 +243,6 @@ ], "response": [] }, - "connector.sync_job_update_stats": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "enrich.delete_policy": { "request": [ "Request: missing json spec query parameter 'master_timeout'" From 02252a0a2ca86d78dd61dddcb0d539312b7c571f Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 7 Jan 2025 14:12:33 +0100 Subject: [PATCH 3/3] restore old changes --- output/openapi/elasticsearch-openapi.json | 9 ++----- output/schema/schema.json | 25 +++++++------------ output/typescript/types.ts | 10 ++++---- .../SyncJobUpdateStatsRequest.ts | 17 ++++++------- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 610cad2ed2..3836654243 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -5352,15 +5352,10 @@ "type": "number" }, "last_seen": { - "description": "The timestamp to use in the `last_seen` property for the connector sync job.", - "type": "number" + "$ref": "#/components/schemas/_types:Duration" }, "metadata": { - "description": "The connector-specific metadata.", - "type": "object", - "additionalProperties": { - "type": "object" - } + "$ref": "#/components/schemas/_types:Metadata" }, "total_document_count": { "description": "The total number of documents in the target index after the sync job finished.", diff --git a/output/schema/schema.json b/output/schema/schema.json index 06c1bfd5c1..a05b928055 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -116441,7 +116441,7 @@ "type": { "kind": "instance_of", "type": { - "name": "integer", + "name": "long", "namespace": "_types" } } @@ -116453,7 +116453,7 @@ "type": { "kind": "instance_of", "type": { - "name": "integer", + "name": "long", "namespace": "_types" } } @@ -116465,7 +116465,7 @@ "type": { "kind": "instance_of", "type": { - "name": "integer", + "name": "long", "namespace": "_types" } } @@ -116477,7 +116477,7 @@ "type": { "kind": "instance_of", "type": { - "name": "integer", + "name": "Duration", "namespace": "_types" } } @@ -116487,17 +116487,10 @@ "name": "metadata", "required": false, "type": { - "kind": "dictionary_of", - "key": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - "singleKey": false, - "value": { - "kind": "user_defined_value" + "kind": "instance_of", + "type": { + "name": "Metadata", + "namespace": "_types" } } }, @@ -116541,7 +116534,7 @@ } ], "query": [], - "specLocation": "connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts#L25-L73" + "specLocation": "connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts#L24-L72" }, { "kind": "response", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index d99a47dc1c..342928f1cf 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10086,11 +10086,11 @@ export interface ConnectorSyncJobPostResponse { export interface ConnectorSyncJobUpdateStatsRequest extends RequestBase { connector_sync_job_id: Id body?: { - deleted_document_count: integer - indexed_document_count: integer - indexed_document_volume: integer - last_seen?: integer - metadata?: Record + deleted_document_count: long + indexed_document_count: long + indexed_document_volume: long + last_seen?: Duration + metadata?: Metadata total_document_count?: integer } } diff --git a/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts b/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts index 9e34447aa7..ac64759f35 100644 --- a/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts +++ b/specification/connector/sync_job_update_stats/SyncJobUpdateStatsRequest.ts @@ -16,11 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -import { Dictionary } from '@spec_utils/Dictionary' -import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { RequestBase } from '@_types/Base' -import { Id } from '@_types/common' -import { integer } from '@_types/Numeric' +import { Id, Metadata } from '@_types/common' +import { integer, long } from '@_types/Numeric' +import { Duration } from '@_types/Time' /** * Set the connector sync job stats. @@ -48,23 +47,23 @@ export interface Request extends RequestBase { /** * The number of documents the sync job deleted. */ - deleted_document_count: integer + deleted_document_count: long /** * The number of documents the sync job indexed. */ - indexed_document_count: integer + indexed_document_count: long /** * The total size of the data (in MiB) the sync job indexed. */ - indexed_document_volume: integer + indexed_document_volume: long /** * The timestamp to use in the `last_seen` property for the connector sync job. */ - last_seen?: integer + last_seen?: Duration /** * The connector-specific metadata. */ - metadata?: Dictionary + metadata?: Metadata /** * The total number of documents in the target index after the sync job finished. */