elasticsearch/docs/reference/behavioral-analytics/apis/post-analytics-collection-event.asciidoc
Kathleen DeRusso ae6474db63
Deprecate Behavioral Analytics CRUD apis (#122960)
* Deprecate Behavioral Analytics CRUD APIs

* Add allowed warning for REST Compatibility tests

* Update docs/changelog/122960.yaml

* Update changelog

* Update docs to add deprecation flags and fix failing tests

* Update changelog

* Update changelog again

* Update docs formatting

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

* Skip asciidoc test

---------

Co-authored-by: Efe Gürkan YALAMAN <efeyalaman@gmail.com>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Co-authored-by: Efe Gürkan YALAMAN <efeguerkan.yalaman@elastic.co>
2025-02-25 16:02:50 +01:00

95 lines
2.3 KiB
Text

[role="xpack"]
[[post-analytics-collection-event]]
=== Post Event to an Analytics Collection
deprecated:[9.0.0]
beta::[]
++++
<titleabbrev>Post Analytics Collection Event</titleabbrev>
++++
.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-analytics[Behavioral analytics APIs].
--
Post an event to a <<behavioral-analytics-overview,Behavioral Analytics>> Collection.
[[post-analytics-collection-event-request]]
==== {api-request-title}
`POST _application/analytics/<collection_name>/event/<event_type>`
[[post-analytics-collection-event-path-params]]
==== {api-path-parms-title}
`<collection_name>`::
(Required, string) Analytics collection name you want to ingest event in.
`<event_type>`::
(Required, string) Analytics event type. Can be one of `page_view`, `search`, `search_click`.
[[post-analytics-collection-event-request-body]]
==== {api-request-body-title}
Full request body parameters can be found in: <<behavioral-analytics-event-reference>>.
[[post-analytics-collection-event-prereqs]]
==== {api-prereq-title}
Requires the `post_behavioral_analytics_event` cluster privilege.
[[post-analytics-collection-event-response-codes]]
==== {api-response-codes-title}
`202`::
Event has been accepted and will be ingested.
`404`::
Analytics Collection `<collection_name>` does not exists.
`400`::
Occurs either when the event type is unknown or when event payload contains invalid data.
[[post-analytics-collection-event-example]]
==== {api-examples-title}
The following example send a `search_click` event to an Analytics Collection called `my_analytics_collection`:
[source,console]
----
POST _application/analytics/my_analytics_collection/event/search_click
{
"session": {
"id": "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9"
},
"user": {
"id": "5f26f01a-bbee-4202-9298-81261067abbd"
},
"search":{
"query": "search term",
"results": {
"items": [
{
"document": {
"id": "123",
"index": "products"
}
}
],
"total_results": 10
},
"sort": {
"name": "relevance"
},
"search_application": "website"
},
"document":{
"id": "123",
"index": "products"
}
}
----
// TEST[skip:Behavioral Analytics APIs emit deprecation warnings and will not be updated]