mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
Some Search docs are migrating from Enterprise Search to Elasticsearch. Update links to these docs to use the new locations. Also update titles and surrounding text.
101 lines
2.2 KiB
Text
101 lines
2.2 KiB
Text
[role="xpack"]
|
|
[[post-analytics-collection-event]]
|
|
=== Post Event to an Analytics Collection
|
|
|
|
beta::[]
|
|
|
|
++++
|
|
<titleabbrev>Post Analytics Collection Event</titleabbrev>
|
|
++++
|
|
|
|
////
|
|
[source,console]
|
|
----
|
|
PUT _application/analytics/my_analytics_collection
|
|
----
|
|
// TESTSETUP
|
|
|
|
[source,console]
|
|
----
|
|
DELETE _application/analytics/my_analytics_collection
|
|
----
|
|
// TEARDOWN
|
|
////
|
|
|
|
Post an event to an 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"
|
|
}
|
|
}
|
|
----
|