Skip to content

Commit 112a43f

Browse files
epughkolchfa-awsnatebower
authored
Revamp docs as UBI has evolved. (#8800)
* Revamp docs as UBI has evolved. Signed-off-by: Eric Pugh <[email protected]> * Use proper spelling Signed-off-by: Eric Pugh <[email protected]> * Discuss tracking events and guids Signed-off-by: Eric Pugh <[email protected]> * Using iso 8601 datetime Signed-off-by: Eric Pugh <[email protected]> * Restructure content into clearer four types. Signed-off-by: Eric Pugh <[email protected]> * Move links around Signed-off-by: Eric Pugh <[email protected]> * Fix missing link Signed-off-by: Eric Pugh <[email protected]> * Responding to feedback Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/schemas.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/schemas.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/ubi-javascript-collector.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/schemas.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/ubi-javascript-collector.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/ubi-javascript-collector.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Language tweak for name Signed-off-by: Eric Pugh <[email protected]> * Provide clickable links Signed-off-by: Eric Pugh <[email protected]> * lots of clean ups * Fix html formatting Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/schemas.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/ubi-javascript-collector.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/ubi-javascript-collector.md Co-authored-by: kolchfa-aws <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Final review for 3.2 release Signed-off-by: Eric Pugh <[email protected]> * Apply suggestions from code review Signed-off-by: kolchfa-aws <[email protected]> * Update _search-plugins/ubi/ubi-javascript-collector.md Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Update _search-plugins/ubi/ubi-javascript-collector.md Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Apply suggestions from code review Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: Eric Pugh <[email protected]> * Fix bad link Signed-off-by: Eric Pugh <[email protected]> --------- Signed-off-by: Eric Pugh <[email protected]> Signed-off-by: kolchfa-aws <[email protected]> Co-authored-by: kolchfa-aws <[email protected]> Co-authored-by: Nathan Bower <[email protected]>
1 parent 2d69299 commit 112a43f

File tree

7 files changed

+203
-265
lines changed

7 files changed

+203
-265
lines changed

_search-plugins/ubi/data-structures.md

Lines changed: 0 additions & 204 deletions
This file was deleted.

_search-plugins/ubi/dsl-queries.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,4 @@ GET ubi_events/_search
9595
```
9696
{% include copy.html %}
9797

98-
You can run the preceding queries in the OpenSearch Dashboards [Query Workbench]({{site.url}}{{site.baseurl}}/search-plugins/sql/workbench/).
99-
100-
A demo workbench with sample data can be found here:
101-
[http://chorus-opensearch-edition.dev.o19s.com:5601/app/OpenSearch-query-workbench](http://chorus-OpenSearch-edition.dev.o19s.com:5601/app/OpenSearch-query-workbench).
98+
You can run the preceding queries in the OpenSearch Dashboards [Dev Tools]({{site.url}}{{site.baseurl}}/dashboards/dev-tools/index-dev/) console.

_search-plugins/ubi/index.md

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ redirect_from:
1111
**Introduced 2.15**
1212
{: .label .label-purple }
1313

14-
**References UBI Specification 1.0.0**
14+
**References UBI Specification 1.3.0**
1515
{: .label .label-purple }
1616

1717
User Behavior Insights (UBI) is a schema for capturing user search behavior. Search behavior consists of the queries that the user submits, the results that are presented to them, and the actions they take on those results. The UBI schema links all user interactions (events) to the search result they were performed on. That is, it not only captures the chronological sequence of events but also captures the causal links between events. Analysis of this behavior is used for improving the quality of search results.
@@ -20,33 +20,66 @@ Client applications such as web pages or apps capture user behavior and send UBI
2020

2121
In principle, queries sent to the server and results returned by the server can be sent to the UBI endpoint from the client. But as an optimization, they can instead be sent directly to the UBI endpoint from the server, without incurring a round-trip to the client. That is the function of the UBI plugin and is not a requirement to adopt UBI.
2222

23-
UBI includes the following elements:
24-
* A machine-readable [schema](https://github.com/o19s/ubi) that faciliates interoperablity of the UBI specification.
25-
* A client-side JavaScript [example reference implementation]({{site.url}}{{site.baseurl}}/search-plugins/ubi/data-structures/) that shows how to capture events and send them to the OpenSearch UBI plugin.
26-
* An OpenSearch [plugin](https://github.com/opensearch-project/user-behavior-insights) that captures server-side behavior.
27-
28-
<!-- vale off -->
2923

30-
The UBI documentation is organized into two categories: *Explanation and reference* and *Tutorials and how-to guides*:
24+
> "how our users are using our product, whether search results were useful for them and whether they clicked on top-n results we gave and all related stuff" -- Data scientist working on search.
3125
32-
*Explanation and reference*
33-
34-
| Link | Description |
35-
| :--------- | :------- |
36-
| [UBI Request/Response Specification](https://github.com/o19s/ubi/) | The industry-standard schema for UBI requests and responses. The current version references UBI Specification 1.0.0. |
37-
| [UBI index schema]({{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/) | Documentation on the individual OpenSearch query and event stores. |
26+
UBI includes the following elements:
27+
* A machine-readable [schema](https://github.com/o19s/ubi) that facilitates interoperability of the UBI specification.
28+
* [ubi.js](https://github.com/opensearch-project/user-behavior-insights/tree/main/ubi-javascript-collector/ubi.js): An (optional) client-side JavaScript library for capturing searches and events.
29+
* An (optional) OpenSearch [plugin](https://github.com/opensearch-project/user-behavior-insights) that streamlines the recording of query data.
3830

31+
Advanced features in OpenSearch, such as the [Search Relevance Workbench]({{site.url}}{{site.baseurl}}/search-plugins/search-relevance/using-search-relevance-workbench/) and the [Hybrid Search Optimizer]({{site.url}}{{site.baseurl}}/search-plugins/search-relevance/optimize-hybrid-search/), build on the data collected according to the UBI specification.
3932

40-
*Tutorials and how-to guides*
33+
<!-- vale off -->
4134

42-
| Link | Description |
43-
| :--------- | :------- |
44-
| [UBI plugin](https://github.com/opensearch-project/user-behavior-insights) | How to install and use the UBI plugin. |
45-
| [UBI client data structures]({{site.url}}{{site.baseurl}}/search-plugins/ubi/data-structures/) | Sample JavaScript structures for populating the event store. |
46-
| [Example UBI query DSL queries]({{site.url}}{{site.baseurl}}/search-plugins/ubi/dsl-queries/) | How to write queries for UBI data in OpenSearch query DSL. |
47-
| [Example UBI SQL queries]({{site.url}}{{site.baseurl}}/search-plugins/ubi/sql-queries/) | How to write analytic queries for UBI data in SQL. |
48-
| [UBI dashboard tutorial]({{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-dashboard-tutorial/) | How to build a dashboard containing UBI data. |
49-
| [Chorus Opensearch Edition](https://github.com/o19s/chorus-opensearch-edition/?tab=readme-ov-file#structured-learning-using-chorus-opensearch-edition) katas | A series of structured tutorials that teach you how to use UBI with OpenSearch through a demo e-commerce store. |
35+
<table>
36+
<tr style="vertical-align: top;">
37+
<td>
38+
<h2>Tutorials</h2>
39+
<ul>
40+
<li><a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-dashboard-tutorial/">Learn to create custom dashboards</a> for visualizing UBI data.</li>
41+
<li> Based on <a href="https://github.com/o19s/chorus-opensearch-edition">Chorus for OpenSearch</a> demo:
42+
<ul>
43+
<li><a href="https://github.com/o19s/chorus-opensearch-edition/blob/main/katas/002_derive_interaction_data.md">Derive Interaction Data from User Clicks.</a></li>
44+
<li><a href="https://github.com/o19s/chorus-opensearch-edition/blob/main/katas/006_protecting_sensitive_information.md">Protecting sensistive information when using UBI.</a></li>
45+
<li><a href="https://github.com/o19s/chorus-opensearch-edition/blob/main/katas/007_configure_AB_with_TDI.md">Configuring an AB test with Team Draft Interleaving</a></li>
46+
</ul>
47+
</li>
48+
</ul>
49+
</td>
50+
<td>
51+
<h2>How To Guides</h2>
52+
<ul>
53+
<li>How to <a href="https://github.com/opensearch-project/user-behavior-insights?tab=readme-ov-file#user-quick-start">install and use the UBI plugin</a> in OpenSearch.</li>
54+
<li>How to use <a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-javascript-collector/">ubi.js</a>, a client-side JavaScript library for capturing events.</li>
55+
<li>How to <a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/dsl-queries/">write queries for UBI data using OpenSearch query DSL.</a></li>
56+
<li>How to <a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/sql-queries/">write analytic queries for UBI data using SQL.</a></li>
57+
</ul>
58+
</td>
59+
</tr>
60+
<tr style="vertical-align: top;">
61+
<td>
62+
<h2>Explanation</h2>
63+
<ul>
64+
<li><a href="https://docs.google.com/presentation/d/e/2PACX-1vTJ9wYhhRG2sHxB-pm2Pfcqv0AzwRzSgTn-VyKTV6bL4PyXQC9C9kE6Oyrkag2_Olb6Ugevs_kbflId/pub?start=true&loop=false&delayms=3000">Why UBI?</a> presentation.</li>
65+
<li>Learn more about this standard via <a href="https://www.UBISearch.dev">https://www.UBISearch.dev</a>, the community clearinghouse.</li>
66+
<li>Watch <a href="https://youtu.be/0chun264PRQ">Leveraging UBI to enhance Search Relevance</a> talk to understand how to use this data to improve search quality.</li>
67+
<li>Go deeper with UBI. Watch <a href="https://www.youtube.com/watch?v=xi261oUamXc">You’ve Deployed User Behavior Insights. Now What?</a> to see what else you can do.</li>
68+
</ul>
69+
</td>
70+
<td>
71+
<h2>Reference</h2>
72+
<ul>
73+
<li><a href="https://github.com/opensearch-project/user-behavior-insights">UBI Plugin for OpenSearch</a></li>
74+
<li><a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/">UBI Schema in OpenSearch</a></li>
75+
<li>Repository for the <a href="https://github.com/o19s/ubi">UBI Schema</a>.</li>
76+
<li><a href="https://o19s.github.io/ubi/docs/html/1.3.0/query.request.schema.html">Query Tracking Specification</a></li>
77+
<li><a href="https://o19s.github.io/ubi/docs/html/1.3.0/event.schema.html">Event Tracking Specification</a></li>
78+
79+
</ul>
80+
</td>
81+
</tr>
82+
</table>
5083

5184
<!-- vale on -->
5285
The documentation categories were adapted using concepts based on [Diátaxis](https://diataxis.fr/).

_search-plugins/ubi/schemas.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ The User Behavior Insights (UBI) data collection process involves tracking and r
1616

1717
For UBI to function properly, the connections between the following fields must be consistently maintained within an application that has UBI enabled:
1818

19-
- [`object_id`](#object_id) represents an ID for whatever object the user receives in response to a query. For example, if you search for books, it might be an ISBN code of a book, such as `978-3-16-148410-0`.
20-
- [`query_id`](#query_id) is a unique ID for the raw query language executed and the `object_id` values of the _hits_ returned by the user's query.
19+
- [`object_id`](#object_id) represents an ID for whatever object the user receives in response to a query. For example, if you search for books, it might be an ISBN for a book, such as `978-3-16-148410-0`.
20+
- [`query_id`](#query_id) is a unique ID for the raw query executed, while the `object_id` maps to the primary identifier of the _hits_ returned by the user's query.
2121
- [`client_id`](#client_id) represents a unique query source. This is typically a web browser used by a unique user.
2222
- [`object_id_field`](#object_id_field) specifies the name of the field in your index that provides the `object_id`. For example, if you search for books, the value might be `isbn_code`.
2323
- [`action_name`](#action_name), though not technically an ID, specifies the exact user action (such as `click`, `add_to_cart`, `watch`, `view`, or `purchase`) that was taken (or not taken) for an object with a given `object_id`.
@@ -138,11 +138,11 @@ All underlying query information and results (`object_ids`) are stored in the `u
138138

139139
The `ubi_queries` index [schema](https://github.com/OpenSearch-project/user-behavior-insights/tree/main/src/main/resources/queries-mapping.json) includes the following fields:
140140

141-
- `timestamp` (events and queries): A UNIX timestamp indicating when the query was received.
141+
- `timestamp` (events and queries): An ISO 8601--formatted timestamp indicating when the query was received.
142142

143-
- `query_id` (events and queries): The unique ID of the query provided by the client or generated automatically. Different queries with the same text generate different `query_id` values.
144-
145-
- `client_id` (events and queries): A user/client ID provided by the client application.
143+
- `query_id` (events and queries): The unique ID of the query provided by the client or generated by the search engine. Different queries with the same text generate different `query_id` values.
144+
145+
- `client_id` (events and queries): A client ID provided by the client application.
146146

147147
- `query_response_objects_ids` (queries): An array of object IDs. An ID can have the same value as the `_id`, but it is meant to be the externally valid ID of a document, item, or product.
148148

@@ -169,14 +169,14 @@ The following are the predefined, minimal fields in the `ubi_events` index:
169169
<p id="query_id"> </p>
170170

171171
- `query_id` (size 100): The unique identifier of a query, which is typically a UUID but can be any string.
172-
The `query_id` is either provided by the client or generated at index time by the UBI plugin. The `query_id` values in both the **UBI queries** and **UBI events** indexes must be consistent.
172+
The `query_id` is either provided by the client or generated at query time by the UBI plugin. The `query_id` values in both the **UBI queries** and **UBI events** indexes must be consistent.
173173

174174
<p id="client_id"> </p>
175175

176176
- `client_id`: The client that issues the query. This is typically a web browser used by a unique user.
177177
The `client_id` in both the **UBI queries** and **UBI events** indexes must be consistent.
178178

179-
- `timestamp`: When the event occurred, either in UNIX format or formatted as `2018-11-13T20:20:39+00:00`.
179+
- `timestamp`: The time at which the event occurred in ISO 8601 format, such as `2018-11-13T20:20:39+00:00Z`.
180180

181181
- `message_type` (size 100): A logical bin for grouping actions (each with an `action_name`). For example, `QUERY` or `CONVERSION`.
182182

@@ -193,18 +193,12 @@ The following are the predefined, minimal fields in the `ubi_events` index:
193193

194194
- `event_attributes.position.ordinal`: Tracks the list position that a user can select (for example, selecting the third element can be described as `event{onClick, results[4]}`).
195195

196-
- `event_attributes.position.{x,y}`: Tracks x and y values defined by the client.
197-
198-
- `event_attributes.position.page_depth`: Tracks the page depth of the results.
199-
200-
- `event_attributes.position.scroll_depth`: Tracks the scroll depth of the page results.
201-
202-
- `event_attributes.position.trail`: A text field that tracks the path/trail that a user took to get to this location.
203-
196+
- `event_attributes.position.xy.{x,y}`: Tracks x and y values defined by the client.
197+
204198
- `event_attributes.object`: Contains identifying information about the object returned by the query (for example, a book, product, or post).
205199
The `object` structure can refer to the object by internal ID or object ID. The `object_id` is the ID that links prior queries to this object. This field comprises the following subfields:
206200

207-
- `event_attributes.object.internal_id`: A unique ID that OpenSearch can use to internally index the object, for example, the `_id` field in the indexes.
201+
- `event_attributes.object.internal_id`: The unique ID that OpenSearch uses to internally index the object, for example, the `_id` field in the indexes.
208202

209203
<p id="object_id">
210204

@@ -214,7 +208,7 @@ The following are the predefined, minimal fields in the `ubi_events` index:
214208

215209
<p id="object_id_field">
216210
217-
- `event_attributes.object.object_id_field`: Indicates the type/class of the object and the name of the search index field that contains the `object_id`.
211+
- `event_attributes.object.object_id_field`: Indicates the type/class of the object and the name of the search index field that contains the `object_id`, such as `ssn`, `isbn`, or `ean`.
218212

219213
- `event_attributes.object.description`: An optional description of the object.
220214

0 commit comments

Comments
 (0)