Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RasonJ committed May 31, 2024
1 parent ad1b92a commit c9edc86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 156 deletions.
95 changes: 0 additions & 95 deletions _search-plugins/ubi/client-data-structures.md

This file was deleted.

60 changes: 2 additions & 58 deletions _search-plugins/ubi/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ to improve search relevance and user experience.

## UBI store

The plugin has a concept of a "store", which is a logical collection of the events and queries. A store consists of two indexes. One
index is used to store events, and the other index is for storing queries.
The plugin has a concept of a "store", which is a logical collection of the events and queries. A store consists of two indexes.
One index is used to store events, and the other index is for storing queries.

### OpenSearch data mappings
UBI has 2 primary indexes:
Expand All @@ -29,62 +29,6 @@ UBI has 2 primary indexes:

## Plugin API

The plugin exposes a REST API for managing UBI stores and persisting events.

| Method | Endpoint | Purpose |
|--------|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `PUT` | `/_plugins/ubi/{store}?index={index}&object_id={object_id}` | <p id="object_id">Initialize a new UBI store for the given index. The `object_id` is optional and allows for providing the name of a field in the `index`'s schema to be used as the unique result/item ID for each search result. If not provided, the `_id` field is used. </p>|
| `DELETE` | `/_plugins/ubi/{store}` | Delete a UBI store |
| `GET` | `/_plugins/ubi` | Get a list of all UBI stores |
| `POST` | `/_plugins/ubi/{store}` | Index an event into the UBI store |
| `TRACE` | `/_plugins/ubi` | For temporary developer debugging |

### Creating a UBI store

To create a UBI store to contain events and queries, send a `PUT` request:

```
PUT http://localhost:9200/_plugins/ubi/mystore?index=ecommerce
```
{% include copy-curl.html %}

### Deleting a UBI store

To delete a store, send a `DELETE` request:

```
DELETE http://localhost:9200/_plugins/ubi/mystore
```
{% include copy-curl.html %}

This will delete the UBI store and all contained events and queries. Use this with caution.

### Get a list of UBI stores

To get a list of stores, send a `GET` request:

```
GET http://localhost:9200/_plugins/ubi
```
{% include copy-curl.html %}

### Persist a client-side event into a UBI store

To persist a client-side event into a store, send a `POST` request where the body of the request is the event:

```
http://localhost:9200/_plugins/ubi/mystore -H "Content-Type: application/json" -d '
{
"action_name": "search",
"user_id": "98fcf189-4fa8-4322-b6f5-63fbb6b556c9",
"timestamp": 1705596607509
}'
```
{% include copy-curl.html %}

## Capturing queries with UBI

You enable the UBI data capture for a query on a query by query basis by adding the parameter `"ubi":true` to your query.

### Associating a query with client-side events

Expand Down
6 changes: 3 additions & 3 deletions _search-plugins/ubi/ubi-dashboard-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Depending on your configuration: http://localhost:5601/app/home#/
## 2) Create an index pattern
http://localhost:5601/app/management/opensearch-dashboards/indexPatterns
![Index Patterns]({{site.url}}{{site.baseurl}}/images/ubi/index_pattern1.png "Index Patterns")
Index patterns are how OpenSearch dashboards access your indexes. In this case, we want to access the *hidden* indexes that UBI creates, so that we can visualize your users' online, search behaviors.
Index patterns are how OpenSearch dashboards access your indexes. In this case, we want to access the indexes that UBI creates, so that we can visualize your users' online, search behaviors.

After you click on "Create index pattern" you'll see a list of indexes in your OpenSearch instance. The UBI stores are hidden by default; so, be sure to click on "Include system and hidden indexes".
After you click on "Create index pattern" you'll see a list of indexes in your OpenSearch instance. The UBI stores may be hidden by default; so, be sure to click on "Include system and hidden indexes".
![Index Patterns]({{site.url}}{{site.baseurl}}/images/ubi/index_pattern2.png "Index Patterns")

With wildcards you can group indexes into the same data source for your dashboard. Assuming the name of your UBI is `chorus`, we'll lump both the query and event stores together as `ubi_chorus*`.
With wildcards you can group indexes into the same data source for your dashboard. So we'll lump both the query and event stores together as `ubi_*`.

It will prompt you to filter on any `date` field in your schema, so that you can look at things like trending queries over the last 15 minutes. However, for your first dashboard, do not filter on any date field.
<img src="{{site.url}}{{site.baseurl}}/images/ubi/index_pattern3.png" alt="Index Patterns" width="400"/>
Expand Down

0 comments on commit c9edc86

Please sign in to comment.