Skip to content

Commit

Permalink
Rebuilding main
Browse files Browse the repository at this point in the history
Signed-off-by: RasonJ <[email protected]>
  • Loading branch information
RasonJ committed Jun 13, 2024
1 parent c9edc86 commit 559d1b8
Show file tree
Hide file tree
Showing 9 changed files with 416 additions and 453 deletions.
2 changes: 1 addition & 1 deletion _search-plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ OpenSearch provides the following search relevance features:

- [Querqy]({{site.url}}{{site.baseurl}}/search-plugins/querqy/): Offers query rewriting capability.

- [User Behavior Insights]({{site.url}}{{site.baseurl}}/search-plugins/ubi/): Link user application behavior to their queries for improving search relevance insights.
- [User Behavior Insights]({{site.url}}{{site.baseurl}}/search-plugins/ubi/): Link user application behavior to their queries for improving search quality.

## Search results

Expand Down
35 changes: 29 additions & 6 deletions _search-plugins/ubi/data-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ nav_order: 7
---

# Sample client data structures
The client data structures can be used to create events that follow the [UBI event schema specification](https://github.com/o19s/opensearch-ubi),
which is describedin further detail [here]({{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/).
The client data structures can be used to create events that follow the [UBI event schema specification](https://github.com/o19s/ubi),
which is described in further detail [here]({{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/).

The developer provides an implementation for the following functions:
- `getClientId()`
Expand All @@ -18,7 +18,7 @@ _Optionally_:
- `getSessionId()`
- `getPageId()`

Other sample implementations can be found [here](#TODO-clients-link).
<!-- Not needed with this page: Other sample implementations can be found [here](#TODO-clients-link). -->

```js
/*********************************************************************************************
Expand Down Expand Up @@ -158,22 +158,45 @@ export class UbiEvent {
# Sample usage

```js
export async function logUbiMessage(event_type, message_type, message){
export function logUbiMessage(event_type, message_type, message){
let e = new UbiEvent(event_type, {
message_type:message_type,
message:message
});
logEvent(e);
}

export async function logDwellTime(action_name, page, seconds){
export function logDwellTime(action_name, page, seconds){
console.log(`${page} => ${seconds}`);
let e = new UbiEvent(action_name, {
message:`On page ${page} for ${seconds} seconds`,
event_attributes:{dwell_seconds:seconds},
event_attributes:{
session_id: getSessionId()},
dwell_seconds:seconds
},
data_object:TimeMe
});
logEvent(e);
}

/**
* ordinal is the number within a list of results
* for the item that was clicked
*/
export function logItemClick(item, ordinal){
let e = new UbiEvent('item_click', {
message:`Item ${item['object_id']} was clicked`,
event_attributes:{session_id: getSessionId()},
data_object:item,
});
e.event_attributes.position.ordinal = ordinal;
logEvent(e);
}

export function logEvent( event ){
// some configured http client
return client.index( index = 'ubi_events', body = event.toJson());
}

```
{% include copy.html %}
2 changes: 1 addition & 1 deletion _search-plugins/ubi/dsl-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nav_order: 8


```json
GET .ubi_log_events/_search
GET ubi_events/_search
{
"size":0,
"aggs":{
Expand Down
21 changes: 8 additions & 13 deletions _search-plugins/ubi/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,30 @@ redirect_from:
**References UBI Draft Specification X.Y.Z**
{: .label .label-purple }

User Behavior Insights, or UBI, is a community plugin for capturing client-side events and queries for the purposes of improving search relevance and user experience.
User Behavior Insights, or UBI, is a plugin for capturing client-side events and queries for the purposes of improving search relevance and user experience.
It is a causal system, linking a user's query to all subsequent user interactions with your application until they perform another search.


* An machine readable [schema](https://github.com/o19s/ubi) that faciliates interoperablity of the UBI specification.
* An OpenSearch [plugin](https://github.com/o19s/opensearch-ubi) that facilitates the storage of client-side events and queries.
* A client-side JavaScript library reference implementation that shows how to capture events and send those events to the OpenSearch UBI plugin.

TODO: link a client implementation [here](#TODO-clients-link)
{: .warn }
* An OpenSearch [plugin](https://github.com/opensearch-project/user-behavior-insights) that facilitates the storage of client-side events and queries.
* A client-side JavaScript [ example ]({{site.url}}{{site.baseurl}}/search-plugins/ubi/data-structures/) reference implementation that shows how to capture events and send those events to the OpenSearch UBI plugin.

<!-- vale off -->

| Explanation & Reference | Description
| :--------- | :------- |
| [UBI Request/Response Specification](https://github.com/o19s/ubi/) <br/> **References UBI Draft Specification X.Y.Z** | Schema standard for making UBI requests and responses |
| [UBI Request/Response Specification](https://github.com/o19s/ubi/) <br/> **References UBI Draft Specification X.Y.Z** | Industry standard schema for making UBI requests and responses |
| [UBI OpenSearch Schema Documentation]({{site.url}}{{site.baseurl}}/search-plugins/ubi/schemas/) | Documentation on the individual Query and Event stores for OpenSearch |
| [`query_id` Data Flow]({{site.url}}{{site.baseurl}}/search-plugins/ubi/query_id/) | How the `query_id` ties the search to results and user events |


| Tutorials & How-to Guides | Description
| :--------- | :------- |
| [UBI Plugin Admin]({{site.url}}{{site.baseurl}}/search-plugins/ubi/documentation/) | How to install and use the UBI Plugin |
| [UBI Plugin ](https://github.com/opensearch-project/user-behavior-insights) | How to install and use the UBI Plugin |
| [ JavaScript client structures ]({{site.url}}{{site.baseurl}}/search-plugins/ubi/data-structures/) | Sample JavaScript structures for populating the Event store |
| [UBI SQL queries ]({{site.url}}{{site.baseurl}}/search-plugins/ubi/sql-queries/) | How to write analytic queries for UBI data in SQL |
| [UBI Dashboard]({{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-dashboard-tutorial/) | Teaches you how to build an OpenSearch dashboard with UBI data |
| ... | teaches how to do something |
| [UBI Dashboard Tutorial]({{site.url}}{{site.baseurl}}/search-plugins/ubi/ubi-dashboard-tutorial/) | Teaches you how to build an OpenSearch dashboard with UBI data |
| [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 UBI with OpenSearch using a demo Ecommerce Store. |

<!-- vale on -->
{: .tip }
Documentation adapted using concepts from [Diátaxis](https://diataxis.fr/)

{: .tip }
89 changes: 0 additions & 89 deletions _search-plugins/ubi/query_id.md

This file was deleted.

Loading

0 comments on commit 559d1b8

Please sign in to comment.