From f1b87625469a0fe4e49dac12d74ccec3c47e5809 Mon Sep 17 00:00:00 2001 From: lcawl Date: Wed, 18 Dec 2024 14:45:26 -0800 Subject: [PATCH 1/7] Add specification for post even to an analytics collection --- output/openapi/elasticsearch-openapi.json | 57 ++++++++ output/schema/schema.json | 126 +++++++++++++++++- output/schema/validation-errors.json | 3 +- output/typescript/types.ts | 10 ++ specification/_doc_ids/table.csv | 1 + .../BehavioralAnalyticsEventPostRequest.ts | 41 ++++++ .../BehavioralAnalyticsEventPostResponse.ts | 42 ++++++ 7 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts create mode 100644 specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 8821b957fe..1898cc905d 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -27177,6 +27177,55 @@ "x-beta": true } }, + "/_application/analytics/{collection_name}/event/{event_type}": { + "post": { + "tags": [ + "analytics" + ], + "summary": "Create a behavioral analytics collection event", + "externalDocs": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/behavioral-analytics-event-reference.html" + }, + "operationId": "search-application-post-behavioral-analytics-event", + "parameters": [ + { + "in": "path", + "name": "collection_name", + "description": "The name of the behavioral analytics collection.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "event_type", + "description": "The analytics event type.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/search_application._types:EventType" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-state": "Technical preview" + } + }, "/_application/search_application/{name}/_render_query": { "post": { "tags": [ @@ -83526,6 +83575,14 @@ "name" ] }, + "search_application._types:EventType": { + "type": "string", + "enum": [ + "page_view", + "search", + "search_click" + ] + }, "search_application.put_behavioral_analytics:AnalyticsAcknowledgeResponseBase": { "allOf": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index 32be7def8b..b8101d5fec 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -14948,15 +14948,24 @@ "visibility": "public" } }, - "description": "Creates a behavioral analytics event for existing collection.", + "description": "Create a behavioral analytics collection event.", + "docTag": "analytics", "docUrl": "http://todo.com/tbd", + "extDocId": "behavioral-analytics-event-reference", + "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/behavioral-analytics-event-reference.html", "name": "search_application.post_behavioral_analytics_event", - "request": null, + "request": { + "name": "Request", + "namespace": "search_application.post_behavioral_analytics_event" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "search_application.post_behavioral_analytics_event" + }, "responseMediaType": [ "application/json" ], @@ -188481,6 +188490,28 @@ ], "specLocation": "search_application/_types/BehavioralAnalytics.ts#L29-L31" }, + { + "kind": "enum", + "members": [ + { + "codegenName": "PageView", + "name": "page_view" + }, + { + "codegenName": "Search", + "name": "search" + }, + { + "codegenName": "SearchClick", + "name": "search_click" + } + ], + "name": { + "name": "EventType", + "namespace": "search_application._types" + }, + "specLocation": "search_application/_types/AnalyticsEvent.ts#L22-L26" + }, { "kind": "interface", "inherits": { @@ -188930,6 +188961,95 @@ }, "specLocation": "search_application/list/SearchApplicationsListResponse.ts#L23-L28" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Create a behavioral analytics collection event.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "search_application.post_behavioral_analytics_event" + }, + "path": [ + { + "description": "The name of the behavioral analytics collection.", + "name": "collection_name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Name", + "namespace": "_types" + } + } + }, + { + "description": "The analytics event type.", + "name": "event_type", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "EventType", + "namespace": "search_application._types" + } + } + } + ], + "query": [], + "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts#L23-L41" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [] + }, + "exceptions": [ + { + "body": { + "kind": "no_body" + }, + "description": "\nEvent has been accepted and will be ingested.", + "statusCodes": [ + 202 + ] + }, + { + "body": { + "kind": "no_body" + }, + "description": "\nEither the event type is unknown or the event payload contains invalid data.", + "statusCodes": [ + 400 + ] + }, + { + "body": { + "kind": "no_body" + }, + "description": "\nAnalytics collection does not exist.", + "statusCodes": [ + 404 + ] + } + ], + "name": { + "name": "Response", + "namespace": "search_application.post_behavioral_analytics_event" + }, + "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts#L20-L42" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 85a585f420..6d66f08431 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -619,7 +619,8 @@ }, "search_application.post_behavioral_analytics_event": { "request": [ - "Missing request & response" + "Request: missing json spec query parameter 'debug'", + "Request: should have a body definition" ], "response": [] }, diff --git a/output/typescript/types.ts b/output/typescript/types.ts index a9bcfd2566..770b37ec38 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -17684,6 +17684,8 @@ export interface SearchApplicationEventDataStream { name: IndexName } +export type SearchApplicationEventType = 'page_view' | 'search' | 'search_click' + export interface SearchApplicationSearchApplication extends SearchApplicationSearchApplicationParameters { name: Name updated_at_millis: EpochTime @@ -17734,6 +17736,14 @@ export interface SearchApplicationListResponse { results: SearchApplicationSearchApplication[] } +export interface SearchApplicationPostBehavioralAnalyticsEventRequest extends RequestBase { + collection_name: Name + event_type: SearchApplicationEventType +} + +export interface SearchApplicationPostBehavioralAnalyticsEventResponse { +} + export interface SearchApplicationPutRequest extends RequestBase { name: Name create?: boolean diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 279300a248..fd7defb3fe 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -18,6 +18,7 @@ autoscaling-get-autoscaling-capacity,https://www.elastic.co/guide/en/elasticsear autoscaling-get-autoscaling-policy,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-get-autoscaling-policy.html autoscaling-put-autoscaling-policy,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-put-autoscaling-policy.html avoid-index-pattern-collisions,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/index-templates.html#avoid-index-pattern-collisions +behavioral-analytics-event-reference,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/behavioral-analytics-event-reference.html byte-units,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/api-conventions.html#byte-units bytes-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/bytes-processor.html calendar-and-fixed-intervals,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-bucket-datehistogram-aggregation.html#calendar_and_fixed_intervals diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts new file mode 100644 index 0000000000..ce67bdd7fa --- /dev/null +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts @@ -0,0 +1,41 @@ +/* + * 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 { Name } from '@_types/common' +import { EventType } from '../_types/AnalyticsEvent' + +/** + * Create a behavioral analytics collection event. + * @rest_spec_name search_application.post_behavioral_analytics_event + * @availability stack stability=experimental visibility=public + * @doc_tag analytics + * @ext_doc_id behavioral-analytics-event-reference + */ +export interface Request extends RequestBase { + path_parts: { + /** + * The name of the behavioral analytics collection. + */ + collection_name: Name + /** + * The analytics event type. + */ + event_type: EventType + } +} diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts new file mode 100644 index 0000000000..ae8f75364f --- /dev/null +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts @@ -0,0 +1,42 @@ +/* + * 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: {} + exceptions: [ + { + /** + * Event has been accepted and will be ingested. + */ + statusCodes: [202] + }, + { + /** + * Either the event type is unknown or the event payload contains invalid data. + */ + statusCodes: [400] + }, + { + /** + * Analytics collection does not exist. + */ + statusCodes: [404] + } + ] +} From a6f192646aa8b7c9780c36aea6550e122d96e39a Mon Sep 17 00:00:00 2001 From: lcawl Date: Wed, 18 Dec 2024 18:12:57 -0800 Subject: [PATCH 2/7] Add doc_id --- output/schema/schema.json | 5 +++-- specification/_doc_ids/table.csv | 1 + .../BehavioralAnalyticsEventPostRequest.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index b8101d5fec..eb9bc0e8d4 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -14949,8 +14949,9 @@ } }, "description": "Create a behavioral analytics collection event.", + "docId": "behavioral-analytics-collection-event", "docTag": "analytics", - "docUrl": "http://todo.com/tbd", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/post-analytics-collection-event.html", "extDocId": "behavioral-analytics-event-reference", "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/behavioral-analytics-event-reference.html", "name": "search_application.post_behavioral_analytics_event", @@ -189007,7 +189008,7 @@ } ], "query": [], - "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts#L23-L41" + "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts#L23-L42" }, { "kind": "response", diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index fd7defb3fe..af03e9641a 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -18,6 +18,7 @@ autoscaling-get-autoscaling-capacity,https://www.elastic.co/guide/en/elasticsear autoscaling-get-autoscaling-policy,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-get-autoscaling-policy.html autoscaling-put-autoscaling-policy,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/autoscaling-put-autoscaling-policy.html avoid-index-pattern-collisions,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/index-templates.html#avoid-index-pattern-collisions +behavioral-analytics-collection-event,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/post-analytics-collection-event.html behavioral-analytics-event-reference,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/behavioral-analytics-event-reference.html byte-units,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/api-conventions.html#byte-units bytes-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/bytes-processor.html diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts index ce67bdd7fa..05e8a668d1 100644 --- a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts @@ -25,6 +25,7 @@ import { EventType } from '../_types/AnalyticsEvent' * @rest_spec_name search_application.post_behavioral_analytics_event * @availability stack stability=experimental visibility=public * @doc_tag analytics + * @doc_id behavioral-analytics-collection-event * @ext_doc_id behavioral-analytics-event-reference */ export interface Request extends RequestBase { From 4ca526aaa17c31cb40ea1b333e54e5e4cd825442 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 19 Dec 2024 09:20:59 -0800 Subject: [PATCH 3/7] Update specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../BehavioralAnalyticsEventPostResponse.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts index ae8f75364f..842bc604f9 100644 --- a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts @@ -18,7 +18,10 @@ */ export class Response { - body: {} + body: { + accepted: boolean + event?: UserDefinedValue + } exceptions: [ { /** From 71ce3e61b5c73a81b972ef11a3d20917ceaad206 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 19 Dec 2024 09:21:14 -0800 Subject: [PATCH 4/7] Update specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../BehavioralAnalyticsEventPostRequest.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts index 05e8a668d1..a176fdbdaf 100644 --- a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts @@ -40,3 +40,11 @@ export interface Request extends RequestBase { event_type: EventType } } + query_parameters: { + /** + * Whether the response type has to include more details + */ + debug?: boolean + } + /** @codegen_name payload */ + body: UserDefinedValue From dbcbe5aafacd879bf84d07fb87e9b3447070c775 Mon Sep 17 00:00:00 2001 From: lcawl Date: Thu, 19 Dec 2024 09:27:04 -0800 Subject: [PATCH 5/7] Fix style --- output/openapi/elasticsearch-openapi.json | 33 ++++++++++++- output/schema/schema.json | 46 +++++++++++++++++-- output/schema/validation-errors.json | 7 --- output/typescript/types.ts | 4 ++ .../BehavioralAnalyticsEventPostRequest.ts | 3 +- .../BehavioralAnalyticsEventPostResponse.ts | 4 +- 6 files changed, 81 insertions(+), 16 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 1898cc905d..348471e7f5 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -27209,15 +27209,46 @@ "$ref": "#/components/schemas/search_application._types:EventType" }, "style": "simple" + }, + { + "in": "query", + "name": "debug", + "description": "Whether the response type has to include more details", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + }, + "required": true + }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "accepted": { + "type": "boolean" + }, + "event": { + "type": "object" + } + }, + "required": [ + "accepted" + ] } } } diff --git a/output/schema/schema.json b/output/schema/schema.json index eb9bc0e8d4..0082c09a06 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -188968,7 +188968,11 @@ "CommonQueryParameters" ], "body": { - "kind": "no_body" + "kind": "value", + "codegenName": "payload", + "value": { + "kind": "user_defined_value" + } }, "description": "Create a behavioral analytics collection event.", "inherits": { @@ -189007,14 +189011,46 @@ } } ], - "query": [], - "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts#L23-L42" + "query": [ + { + "description": "Whether the response type has to include more details", + "name": "debug", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts#L24-L51" }, { "kind": "response", "body": { "kind": "properties", - "properties": [] + "properties": [ + { + "name": "accepted", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "event", + "required": false, + "type": { + "kind": "user_defined_value" + } + } + ] }, "exceptions": [ { @@ -189049,7 +189085,7 @@ "name": "Response", "namespace": "search_application.post_behavioral_analytics_event" }, - "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts#L20-L42" + "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts#L20-L45" }, { "kind": "request", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 6d66f08431..3b2613f018 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -617,13 +617,6 @@ ], "response": [] }, - "search_application.post_behavioral_analytics_event": { - "request": [ - "Request: missing json spec query parameter 'debug'", - "Request: should have a body definition" - ], - "response": [] - }, "search_mvt": { "request": [ "Request: query parameter 'grid_agg' does not exist in the json spec", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 770b37ec38..e67511c3e7 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -17739,9 +17739,13 @@ export interface SearchApplicationListResponse { export interface SearchApplicationPostBehavioralAnalyticsEventRequest extends RequestBase { collection_name: Name event_type: SearchApplicationEventType + debug?: boolean + body?: any } export interface SearchApplicationPostBehavioralAnalyticsEventResponse { + accepted: boolean + event?: any } export interface SearchApplicationPutRequest extends RequestBase { diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts index a176fdbdaf..a6d7c64bf4 100644 --- a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequest.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { RequestBase } from '@_types/Base' import { Name } from '@_types/common' import { EventType } from '../_types/AnalyticsEvent' @@ -39,7 +40,6 @@ export interface Request extends RequestBase { */ event_type: EventType } -} query_parameters: { /** * Whether the response type has to include more details @@ -48,3 +48,4 @@ export interface Request extends RequestBase { } /** @codegen_name payload */ body: UserDefinedValue +} diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts index 842bc604f9..c812720f2f 100644 --- a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts @@ -19,8 +19,8 @@ export class Response { body: { - accepted: boolean - event?: UserDefinedValue + accepted: boolean + event?: UserDefinedValue } exceptions: [ { From bcc563fceb119eba2216134742828d9f05ac709e Mon Sep 17 00:00:00 2001 From: lcawl Date: Thu, 2 Jan 2025 18:27:12 -0800 Subject: [PATCH 6/7] Add post analytics collection event example --- docs/overlays/elasticsearch-openapi-overlays.yaml | 11 ++++++++++- ...BehavioralAnalyticsEventPostRequestExample1.yaml | 13 +++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequestExample1.yaml diff --git a/docs/overlays/elasticsearch-openapi-overlays.yaml b/docs/overlays/elasticsearch-openapi-overlays.yaml index b5d1b10912..2f91c70855 100644 --- a/docs/overlays/elasticsearch-openapi-overlays.yaml +++ b/docs/overlays/elasticsearch-openapi-overlays.yaml @@ -392,6 +392,16 @@ actions: examples: indicesLegacyPutTemplateRequestExample1: $ref: "../../specification/indices/put_template/indicesPutTemplateRequestExample1.yaml" +## Examples for behavioral analytics + - target: "$.paths['/_application/analytics/{collection_name}/event/{event_type}']['post']" + description: "Add examples for post analytics collection event operation" + update: + requestBody: + content: + application/json: + examples: + postBehavioralAnalyticsEventRequestExample1: + $ref: "../../specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequestExample1.yaml" ## Examples for licensing - target: "$.paths['/_license/basic_status']['get']" description: "Add example for get basic status response" @@ -461,4 +471,3 @@ actions: $ref: "../../specification/search_application/render_query/SearchApplicationsRenderQueryRequestExample1.yaml" renderSearchApplicationQueryResponseExample1: $ref: "../../specification/search_application/render_query/SearchApplicationsRenderQueryResponseExample1.yaml" - diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequestExample1.yaml b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequestExample1.yaml new file mode 100644 index 0000000000..d52bfbdd3d --- /dev/null +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequestExample1.yaml @@ -0,0 +1,13 @@ +# summary: behavioral-analytics/apis/post-analytics-collection-event.asciidoc:69 +# method_request: POST _application/analytics/my_analytics_collection/event/search_click +description: Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an analytics collection called `my_analytics_collection`. +# type: request +value: + "{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n\ + \ },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n\ + \ \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\"\ + : [\n {\n \"document\": {\n \"id\": \"123\",\n \ + \ \"index\": \"products\"\n }\n }\n ],\n \"total_results\"\ + : 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\"\ + : \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\ + \n }\n}" From fc0037beeb2db584e34519ecef5c277be5cf0b1a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 3 Jan 2025 10:17:59 +0400 Subject: [PATCH 7/7] Fix compilation --- output/schema/schema-serverless.json | 22 +++++++++++++++++++ output/schema/schema.json | 2 +- .../BehavioralAnalyticsEventPostResponse.ts | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 4be8865e35..089a05476e 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -103373,6 +103373,28 @@ }, "specLocation": "rollup/get_jobs/types.ts#L66-L72" }, + { + "kind": "enum", + "members": [ + { + "codegenName": "PageView", + "name": "page_view" + }, + { + "codegenName": "Search", + "name": "search" + }, + { + "codegenName": "SearchClick", + "name": "search_click" + } + ], + "name": { + "name": "EventType", + "namespace": "search_application._types" + }, + "specLocation": "search_application/_types/AnalyticsEvent.ts#L22-L26" + }, { "kind": "enum", "members": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index 0082c09a06..ba9b24d03c 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -189085,7 +189085,7 @@ "name": "Response", "namespace": "search_application.post_behavioral_analytics_event" }, - "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts#L20-L45" + "specLocation": "search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts#L22-L47" }, { "kind": "request", diff --git a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts index c812720f2f..a4e3a8d7e5 100644 --- a/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts +++ b/specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostResponse.ts @@ -17,6 +17,8 @@ * under the License. */ +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' + export class Response { body: { accepted: boolean