Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp docs as UBI has evolved. #8800

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

epugh
Copy link
Collaborator

@epugh epugh commented Nov 23, 2024

Description

UBI has evolved since it was first released in May 2024. This is an update of the documentation. We have introduced an explicit JS client, so we can streamline the documentation by referencing the deployed document.

Issues Resolved

Will solve opensearch-project/user-behavior-insights#61

Version

2.18

Frontend features

n/a

Checklist

  • [x ] By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Eric Pugh <epugh@opensourceconnections.com>
@epugh
Copy link
Collaborator Author

epugh commented Nov 23, 2024

Replaces #8799 which has signoff/rebase issues.

Copy link

Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged.

Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer.

When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review.

@epugh
Copy link
Collaborator Author

epugh commented Nov 23, 2024

@jzonthemtn could you give a quick pass through on the tech side... I don't think much has changed!

Signed-off-by: Eric Pugh <epugh@opensourceconnections.com>
Signed-off-by: Eric Pugh <epugh@opensourceconnections.com>
Signed-off-by: Eric Pugh <epugh@opensourceconnections.com>
@epugh
Copy link
Collaborator Author

epugh commented Nov 26, 2024

This documentation PR is ready for review.

@epugh
Copy link
Collaborator Author

epugh commented Dec 16, 2024

I wanted to follow up and see if we could get this merged?

@kolchfa-aws
Copy link
Collaborator

@epugh Thanks for following up! I will review this week and put it through editorial review. Please tag me if you have any questions.

Copy link
Collaborator

@kolchfa-aws kolchfa-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epugh Please see my comments and let me know if you have any questions. Thanks.

@@ -39,7 +41,7 @@ The UBI documentation is organized into two categories: *Explanation and referen
| Link | Description |
| :--------- | :------- |
| [UBI plugin](https://github.com/opensearch-project/user-behavior-insights) | How to install and use the UBI plugin. |
| [UBI client data structures]({{site.url}}{{site.baseurl}}/search-plugins/ubi/data-structures/) | Sample JavaScript structures for populating the event store. |
| [UBI JavaScript Collector]({{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-javascript-collector/) | Clientside JavaScript library to capture events. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| [UBI JavaScript Collector]({{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-javascript-collector/) | Clientside JavaScript library to capture events. |
| [UBI JavaScript Collector]({{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-javascript-collector/) | A client-side JavaScript library for capturing events. |

@@ -16,8 +16,8 @@ The User Behavior Insights (UBI) data collection process involves tracking and r

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

- [`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`.
- [`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.
- [`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 number for a book, such as `978-3-16-148410-0`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [`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 number for a book, such as `978-3-16-148410-0`.
- [`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`.

- [`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`.
- [`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.
- [`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 number for a book, such as `978-3-16-148410-0`.
- [`query_id`](#query_id) is a unique ID for the raw query language executed and the `object_id` maps to the primary identifier of the _hits_ returned by the user's query.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reword this? Query ID seems to be a unique ID for the raw query, correct? Not the query language?

Suggested change
- [`query_id`](#query_id) is a unique ID for the raw query language executed and the `object_id` maps to the primary identifier of the _hits_ returned by the user's query.
- [`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.

@@ -138,11 +138,11 @@ All underlying query information and results (`object_ids`) are stored in the `u

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:

- `timestamp` (events and queries): A UNIX timestamp indicating when the query was received.
- `timestamp` (events and queries): A ISO 8601 formatted timestamp indicating when the query was received.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `timestamp` (events and queries): A ISO 8601 formatted timestamp indicating when the query was received.
- `timestamp` (events and queries): An ISO 8601-formatted timestamp indicating when the query was received.


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

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

- `timestamp`: When the event occurred, either in UNIX format or formatted as `2018-11-13T20:20:39+00:00`.
- `timestamp`: When the event occurred, using ISO 8601 format such as `2018-11-13T20:20:39+00:00Z`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `timestamp`: When the event occurred, using ISO 8601 format such as `2018-11-13T20:20:39+00:00Z`.
- `timestamp`: The time the event occurred in ISO 8601 format, such as `2018-11-13T20:20:39+00:00Z`.

The method `getQueryId()` refers to a helper method to generate a unique query id (and stores it in the session).
Here is a sample method:

```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```js

}
return id;
};
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```
{% include copy.html %}


## Tracking the event

Sending the event to the backend is as simple as:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sending the event to the backend is as simple as:
You can send the event to the backend by calling the `trackEvent` method:


## Tracking queries

You have the option of tracking queries using the client (instead of using the UBI plugin for OpenSearch).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You have the option of tracking queries using the client (instead of using the UBI plugin for OpenSearch).
You can optionally track queries using the client (instead of using the UBI plugin for OpenSearch).


You have the option of tracking queries using the client (instead of using the UBI plugin for OpenSearch).

This looks very similar to tracking events:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This looks very similar to tracking events:
The code is similar to tracking events:

@kolchfa-aws kolchfa-aws added the backport 2.18 PR: Backport label for 2.18 label Dec 16, 2024
@kolchfa-aws
Copy link
Collaborator

@epugh Just checking in on this PR. I'd like to get it through editorial review because UBI is part of 2.19 now.

@kolchfa-aws kolchfa-aws added backport 2.19 and removed backport 2.18 PR: Backport label for 2.18 labels Feb 14, 2025
@epugh
Copy link
Collaborator Author

epugh commented Feb 14, 2025

@epugh Just checking in on this PR. I'd like to get it through editorial review because UBI is part of 2.19 now.

Thanks for checking in. Let me add it to the list for next week to update the PR. One big thing is that we now have a "OpenSearch Ingestion" template for people to use, and that isn't part of this PR....

@epugh epugh marked this pull request as draft February 17, 2025 20:43
| [UBI index schema]({{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/) | Documentation on the individual OpenSearch query and event stores. |
UBI includes the following elements:
* [ubi.js](https://github.com/opensearch-project/user-behavior-insights/tree/main/ubi-javascript-collector/ubi.js): a client-side JavaScript library that captures searches and events.
* A machine-readable [schema](https://github.com/o19s/ubi) that faciliates interoperablity of the UBI specification.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: interoperability

| :--------- | :------- |
| [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. |
| [UBI index schema]({{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/) | Documentation on the individual OpenSearch query and event stores. |
UBI includes the following elements:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be unclear when I'm new to UBI: Do I need all these elements?

I could imagine a diagram being helpful at the beginning of this page to show the recommended way of using UBI and how the different elements play together.

<td>
<h2>Explanation</h2>
<ul>
<li><a href="https://UBISearch.dev">Why UBI?</a></li>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this page should answer "Why UBI?". If it doesn't no one will follow any link presented on this page.

Additionally, two links to the community page are not necessary.

<td>
<h2>How To Guides</h2>
<ul>
<li><a href="https://github.com/opensearch-project/user-behavior-insights">How to install and use the UBI plugin</a><b>do we keep this</b></li>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first item in the "How To Guides" section should take the user to the recommended way to use UBI.

I'm in favor of keeping the installation as plugin for now at least.

<li><a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-dashboard-tutorial/">How to build a custom dashboard with UBI data.</a></li>
<li><a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/dsl-queries/">How to write queries for UBI data in OpenSearch query DSL.</a></li>
<li><a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/sql-queries/">How to write analytic queries for UBI data in SQL.</a></li>
<li><a href="https://github.com/o19s/chorus-opensearch-edition/blob/main/katas/006_protecting_sensitive_information.md">How to protect sensistive information when using UBI.</a> <small>Part of Chorus series.</small></li>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do readers of the documentation know about the Chorus series? Is Part of Chorus series. a helpful information?

<ul>
<li><a href="https://o19s.github.io/ubi/docs/html/1.2.0/query.request.schema.html">Query Tracking Specification</a></li>
<li><a href="https://o19s.github.io/ubi/docs/html/1.2.0/event.schema.html">Event Tracking Specification</a></li>
<li><a href="{{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/">UBI Plugin Schema</a><b>DO WE KEEP THIS</b></li>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it adds value as it gives an explanation to the schema. Having that said, I can see that this might be more of an explanation than a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants