Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 2.44 KB

001_alice_needs_a_new_laptop.md

File metadata and controls

31 lines (19 loc) · 2.44 KB

Kata 001: Alice needs a new Laptop!

Alice just started a new job on the ecommerce team at Chorus Electronics. A perk of the job is that she can select any laptop computer they sell to use for work. So off she goes to their website to pick out her perfect laptop computer.

She brings up the website, at http://localhost:4000, and she knows that she needs a laptop style computer, but doesn't have a specific type or brand in mind, so she searches for notebook. Uh oh! The first set of results are all accessories for a laptop computer, not the laptop itself.

Now those of us in the search business suspect that this is the classic accessories problem! She chooses from the "Filter by Product Type" set of options the "Notebook" filter, and is immediately rewarded with just laptop computers. She picks the third laptop shown, a HP EliteBook 2530p Notebook to add to her cart (by double clicking the product image).

We now have a signal from Alice that when she searches for first "notebook" and then picks a option from Filter by Product Type that our query "notebook" is underperforming as it requires additional filtering to be applied before reasonable products are returned.

Alice is curious, the behavior that she was exhibiting, how are we capturing that? She knows we have the OpenSearch User Behavior Insights feature enabled, so there should be data in the backend showing her exact journey.

She opens up a OpenSearch Notebook at http://localhost:5601/app/observability-notebooks to do some data analysis and clicks Create notebook. She names it "My Activity" and then clicks Add Code Block to actually query some data.

She grabs her client_id from the Chorus website, and then creates a SQL query:

%sql
SELECT query_id, message_type, action_name, event_attributes, message, timestamp 
FROM ubi_events 
WHERE client_id='USER-eeed-43de-959d-90e6040e84f9' 
ORDER BY timestamp DESC

She can now see the set of on_search events generated by typing notebook, and then a series of product_hover events from mousing over the various products.

Then, there is a type_filter from picking the Product Type facet. And finally, with the actual laptops she was interested in showing up, she can see that the add_to_cart event when she added the HP EliteBook to her shopping cart!

Tip

If we only looked at the Server side Events, we would not know that the search for notebook and then the follow up filtering choice are connected events.