Whether you've been collecting user events and queries for a while, or you uploaded some sample events, now you're ready to visualize them in the dashboard!
Depending on your configuration: http://localhost:5601/app/home#/
http://localhost:5601/app/management/opensearch-dashboards/indexPatterns
Index patterns are how OpenSearch dashboards access your indices.
After you click on "Create index pattern" you'll see a list of indices in your OpenSearch instance. The UBI stores may be hidden by default; so, be sure to click on "Include system and hidden indices".
With wildcards you can group indices into the same data source for your dashboard.
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, etc. However, for your first dashboard, do not filter on any date field.
Click on "Create index pattern", and you're ready to start building your dashboard pointing to your UBI store!
http://localhost:5601/app/opensearch_dashboards_overview#/
The screen will bring up an empty dashboard, ready for you to add some analytic widgets. We'll start with a pie chart. Click on "Create new" and select a pie chart visualization. Then select the index patter you made in Step 2.
Create new | Visualizations |
---|---|
Most of the visualization require some sort of aggregate function on an bucket/facet/aggregatable field (i.e. numeric or keyword). We'll add a Terms
aggregation on the field action_name
so that we can see the distribution across event names. Change the size to the number of slices you want to display.
Save that visualization and it will be added to your new dashboard. Now that you have a visualization on your dashboard, you can save your dashboard.
Let's add a word cloud for trending searches. Choose the Tag Cloud visualization of the terms in the message
field where the javascript client logs the raw text that the user searches on. (Note: the true query, as processed by OpenSearch with filters, boosting, etc. will be in the ubi_queries
index, but what we are looking at is the message
field of the ubi_events
index, where the javascript client captures what the user actually typed. )
But there's a problem! The message
field is on every event --not just query/search events-- and can be used in anyway the client developer decides to use it; so, it can contain error messages, debug messages, click information, etc.
We need to add a filter to only see search terms on query events. Since the developer gave a message_type
of QUERY
for each search event, we will filter on that message type to isolate just the users' searches.
You should now have two visualizations on your dashboard.
To add a histogram, first, add a vertical bar chart.
The data field we want to examine is event_attributes.position.ordinal
, meaning the user clicked on the nth item in a list. The y-axis will be the number of times that nth was clicked. The x-axis will be the ordinal number itself that was clicked, using the Histogram
aggregation.
For example, let's see how the click position changes when there is a purchase, by adding this filter action_name:product_purchase
.
Or let's see what event messages include "*laptop*" somewhere between the wildcards.
You now have a basic dashboard that lets you look at the data. In the next Katas we'll focus on some typical ecommerce driven scenarios.