833b12ecc1
* [DOCS] Lens features and changes for 7.14 * Aggregation reference * Formatting * Fixes terminology * Updates from 8-Jul meeting * Terminology * Updates terminology, images, and tutorial steps * Update docs/user/dashboard/lens-advanced.asciidoc Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> * Update docs/user/dashboard/create-panels-with-editors.asciidoc Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> * Update docs/user/dashboard/lens.asciidoc Co-authored-by: Wylie Conlon <wylieconlon@gmail.com> * Comments from review * Cleans up unused images * Fixes image reference Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
362 lines
12 KiB
Text
362 lines
12 KiB
Text
[[create-a-dashboard-of-panels-with-ecommerce-data]]
|
|
== Analyze time series data
|
|
|
|
In this tutorial, you'll use the ecommerce sample data to analyze sales trends, but you can use any type of data to complete the tutorial.
|
|
Before using this tutorial, review the <<kibana-concepts-analysts>>.
|
|
|
|
[role="screenshot"]
|
|
image::images/final_time_series_analysis_dashboard.png[Final dashboard with ecommerce sample data, width=50%]
|
|
|
|
[discrete]
|
|
[[add-the-data-and-create-the-dashboard-advanced]]
|
|
=== Add the data and create the dashboard
|
|
|
|
Add the sample ecommerce data that you'll use to create the dashboard panels.
|
|
|
|
. Go to the {kib} *Home* page, then click *Try our sample data*.
|
|
|
|
. On the *Sample eCommerce orders* card, click *Add data*.
|
|
|
|
Create the dashboard where you'll display the visualization panels.
|
|
|
|
. Open the main menu, then click *Dashboard*.
|
|
|
|
. On the *Dashboards* page, click *Create dashboard*.
|
|
|
|
[float]
|
|
[[open-and-set-up-lens-advanced]]
|
|
=== Open and set up Lens
|
|
|
|
Open *Lens*, then make sure the correct fields appear.
|
|
|
|
. From the dashboard, click *Create visualization*.
|
|
|
|
. Make sure the *kibana_sample_data_ecommerce* index appears.
|
|
+
|
|
If you are using your own data, select the <<index-patterns, index pattern>> that contains your data.
|
|
|
|
[discrete]
|
|
[[custom-time-interval]]
|
|
=== View a date histogram with a custom time interval
|
|
|
|
It is common to use the automatic date histogram interval, but sometimes you want a larger or smaller
|
|
interval. For performance reasonse, *Lens* lets you choose the minimum time interval, not the exact time interval. The performance limit is controlled by the <<histogram-maxbars, `histogram:maxBars`>> setting and the <<set-time-filter,time range>>.
|
|
|
|
If you are using your own data, use one of the following options to see hourly sales over the last 30 days:
|
|
|
|
* View less than 30 days at a time, then use the time filter to select each day separately.
|
|
|
|
* Increase `histogram:maxBars` to at least 720, which is the number of hours in 30 days. This affects all visualizations and can reduce performance.
|
|
|
|
If you are using the sample data, use *Normalize unit*, which converts *Average sales per 12 hours*
|
|
into *Average sales per 12 hours (per hour)* by dividing the number of hours:
|
|
|
|
. Set the <<set-time-filter,time filter>> to *Last 30 days*.
|
|
|
|
. From the *Available fields* list, drag *Records* to the workspace.
|
|
|
|
. To zoom in on the data you want to view, click and drag your cursor across the bars.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_advanced_1_1.png[Added records to the workspace]
|
|
|
|
. In the layer pane, click *Count of Records*.
|
|
|
|
.. In the *Display name* field, enter `Number of orders`.
|
|
|
|
.. Click *Add advanced options > Normalize by unit*.
|
|
|
|
.. From the *Normalize by unit* dropdown, select *per hour*, then click *Close*.
|
|
|
|
. To hide the *Horizontal axis* label, open the *Bottom Axis* menu, then deselect *Show*.
|
|
+
|
|
You have a bar chart that shows you how many orders were made at your store every hour.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_advanced_1_2.png[Orders per day]
|
|
|
|
. Click *Save and return*.
|
|
|
|
[discrete]
|
|
[[add-a-data-layer-advanced]]
|
|
=== Monitor multiple series
|
|
|
|
It is often required to monitor multiple series within a time interval. These series can have similar configurations with minor differences.
|
|
*Lens* copies a function when you drag it to the *Drop a field or click to add* field within the same group.
|
|
|
|
To quickly create many copies of a percentile metric that shows distribution of price over time:
|
|
|
|
. On the dashboard, click *Create visualization*.
|
|
|
|
. Open the *Chart Type* dropdown, then select *Line*.
|
|
|
|
. From the *Available fields* list, drag *products.price* to the workspace.
|
|
|
|
Create the 95th percentile.
|
|
|
|
. In the layer pane, click *Median of products.price*.
|
|
|
|
. Click the *Percentile* function.
|
|
|
|
. In the *Display name* field, enter `95th`, then click *Close*.
|
|
|
|
To create the 90th percentile, duplicate the `95th` percentile.
|
|
|
|
. Drag the *95th* field to the *Drop a field or click to add* field in the *Vertical axis* group.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_advanced_2_2.gif[Easily duplicate the items with drag and drop]
|
|
|
|
. Click *95th [1]*, then enter `90` in the *Percentile* field.
|
|
|
|
. In the *Display name* field enter `90th`, then click *Close*.
|
|
|
|
. Repeat the duplication steps to create the `50th` and `10th` percentiles.
|
|
|
|
. Open the *Left Axis* menu, then enter `Percentiles for product prices` in the *Axis name* field.
|
|
+
|
|
You have a line chart that shows you the price distribution of products sold over time.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_advanced_2_3.png[Percentiles for product prices chart]
|
|
|
|
. Click *Save and return*.
|
|
|
|
[discrete]
|
|
[[add-a-data-layer]]
|
|
==== Add multiple chart types or index patterns
|
|
|
|
To overlay visualization types or index patterns, add layers. When you create layered charts, match the data on the horizontal axis so that it uses the same scale.
|
|
|
|
. On the dashboard, click *Create visualization*.
|
|
|
|
. From the *Available fields* list, drag *products.price* to the workspace.
|
|
|
|
. In the layer pane, click *Median of products.price*.
|
|
|
|
.. Click the *Average* function.
|
|
|
|
.. In the *Display name* field, enter `Average of prices`, then click *Close*.
|
|
|
|
. Open the *Chart Type* dropdown, then select *Area*.
|
|
|
|
Create a new layer to overlay with custom traffic.
|
|
|
|
. In the layer pane, click *+*.
|
|
|
|
. From the *Available fields* list, drag *customer_id* to the *Vertical Axis* field in the second layer.
|
|
|
|
. In the second layer, click *Unique count of customer_id*.
|
|
|
|
.. In the *Display name* field, enter `Unique customers`.
|
|
|
|
.. In the *Series color* field, enter *#D36086*.
|
|
|
|
.. Click *Right* for the *Axis side*, then click *Close*.
|
|
|
|
. From the *Available fields* list, drag *order_date* to the *Horizontal Axis* field in the second layer.
|
|
|
|
. In the second layer pane, open the *Chart type* menu, then click the line chart.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_advanced_3_2.png[Change layer type]
|
|
|
|
. Open the *Legend* menu, then select the arrow that points up.
|
|
|
|
. Click *Save and return*.
|
|
|
|
[discrete]
|
|
[[percentage-stacked-area]]
|
|
=== Compare the change in percentage over time
|
|
|
|
By default, *Lens* shows *date histograms* using a stacked chart visualization, which helps understand how distinct sets of documents perform over time. Sometimes it is useful to understand how the distributions of these sets change over time.
|
|
Combine *filters* and *date histogram* functions to see the change over time in specific
|
|
sets of documents. To view this as a percentage, use a *Stacked percentage* bar or area chart.
|
|
|
|
. On the dashboard, click *Create visualization*.
|
|
|
|
. From the *Available fields* list, drag *Records* to the workspace.
|
|
|
|
. Open the *Chart type* dropdown, then select *Area percentage*.
|
|
|
|
For each category type, create a filter.
|
|
|
|
. In the layer pane, click the *Drop a field or click to add* field for *Break down by*.
|
|
|
|
. Click the *Filters* function.
|
|
|
|
. Click *All records*, enter the following, then press Return:
|
|
|
|
* *KQL* — `category.keyword : *Clothing`
|
|
|
|
* *Label* — `Clothing`
|
|
|
|
. Click *Add a filter*, enter the following, then press Return:
|
|
|
|
* *KQL* — `category.keyword : *Shoes`
|
|
|
|
* *Label* — `Shoes`
|
|
|
|
. Click *Add a filter*, enter the following, then press Return:
|
|
|
|
* *KQL* — `category.keyword : *Accessories`
|
|
|
|
* *Label* — `Accessories`
|
|
|
|
. Click *Close*.
|
|
|
|
. Open the *Legend* menu, then select the arrow that points up.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_advanced_4_1.png[Prices share by category]
|
|
|
|
. Click *Save and return*.
|
|
|
|
[discrete]
|
|
[[view-the-cumulative-number-of-products-sold-on-weekends]]
|
|
=== View the cumulative number of products sold on weekends
|
|
|
|
To determine the number of orders made only on Saturday and Sunday, create an area chart, then add it to the dashboard.
|
|
|
|
. On the dashboard, click *Create visualization*.
|
|
|
|
. Open the *Chart Type* dropdown, then select *Area*.
|
|
|
|
Configure the cumulative sum of the store orders.
|
|
|
|
. From the *Available fields* list, drag *Records* to the workspace.
|
|
|
|
. In the layer pane, click *Count of Records*.
|
|
|
|
. Click the *Cumulative sum* function.
|
|
|
|
. In the *Display name* field, enter `Cumulative orders during weekend days`, then click *Close*.
|
|
|
|
Filter the results to display the data for only Saturday and Sunday.
|
|
|
|
. In the layer pane, click the *Drop a field or click to add* field for *Break down by*.
|
|
|
|
. Click the *Filters* function.
|
|
|
|
. Click *All records*, enter the following, then press Return:
|
|
|
|
* *KQL* — `day_of_week : "Saturday" or day_of_week : "Sunday"`
|
|
|
|
* *Label* — `Saturday and Sunday`
|
|
+
|
|
The <<kuery-query,KQL filter>> displays all documents where `day_of_week` matches `Saturday` or `Sunday`.
|
|
|
|
. Open the *Legend* menu, then click *Hide*.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_advanced_5_2.png[Line chart with cumulative sum of orders made on the weekend]
|
|
|
|
. Click *Save and return*.
|
|
|
|
[discrete]
|
|
[[compare-time-ranges]]
|
|
=== Compare time ranges
|
|
|
|
*Lens* allows you to compare the selected time range with historical data using the *Time shift* option.
|
|
|
|
If multiple time shifts are used in a single chart, a multiple of the date histogram interval should be chosen, or the data points might not line up and gaps can appear.
|
|
For example, if a daily interval is used, shifting one series by *36h*, and another by *1d* is not recommended. You can reduce the interval to *12h*, or create two separate charts.
|
|
|
|
To compare current sales numbers with sales from a week ago, follow these steps:
|
|
|
|
. On the dashboard, click *Create visualization*.
|
|
|
|
. Open the *Chart Type* dropdown, then select *Line*.
|
|
|
|
. From the *Available fields* list, drag *Records* to the workspace.
|
|
|
|
. In the layer pane, drag *Count of Records* to the *Drop a field or click to add* field in the *Vertical axis* group.
|
|
|
|
To create a week-over-week comparison, shift the second *Count of Records* by one week.
|
|
|
|
. In the layer pane, click *Count of Records [1]*.
|
|
|
|
. Open the *Add advanced options* dropdown, then select *Time shift*.
|
|
|
|
. Click *1 week ago*.
|
|
+
|
|
To define custom time shifts, enter the time value, the time increment, then press Enter. For example, to use a one week time shift, enter *1w*.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_time_shift.png[Line chart with week-over-week sales comparison]
|
|
|
|
. Click *Save and return*.
|
|
|
|
[float]
|
|
[[compare-time-as-percent]]
|
|
==== Compare time ranges as a percent change
|
|
|
|
To view the percent change in sales between the current time and the previous week, create a *Formula*.
|
|
|
|
. On the dashboard, click *Create visualization*.
|
|
|
|
. From the *Available fields* list, drag *Records* to the workspace.
|
|
|
|
. In the layer pane, click *Count of Records*.
|
|
|
|
.. Click *Formula*, then enter `count() / count(shift='1w') - 1`.
|
|
|
|
.. Open the *Value format* dropdown, select *Percent*, then enter `0` in the *D*ecimals* field.
|
|
|
|
.. In the *Display name* field, enter `Percent change`, then click *Close*.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_percent_chage.png[Bar chart with percent change in sales between the current time and the previous week]
|
|
|
|
. Click *Save and return*.
|
|
|
|
[discrete]
|
|
[[view-customers-over-time-by-continents]]
|
|
=== Create a table of customers by category over time
|
|
|
|
Tables are useful when you want to display the actual field values.
|
|
You can build a date histogram table, and group the customer count metric by category, such as the continent registered in user accounts.
|
|
|
|
In *Lens* you can split the metric in a table leveraging the *Columns* field, where each data value from the aggregation is used as column of the table and the relative metric value is shown.
|
|
|
|
. On the dashboard, click *Create visualization*.
|
|
|
|
. Open the *Chart Type* dropdown, then click *Table*.
|
|
|
|
. From the *Available fields* list, drag *customer_id* to the *Metrics* field in the layer pane.
|
|
|
|
. In the layer pane, click *Unique count of customer_id*.
|
|
|
|
. In the *Display name* field, enter `Customers`, then click *Close*.
|
|
|
|
. From the *Available fields* list, drag *order_date* to the *Rows* field in the layer pane.
|
|
|
|
. In the layer pane, click the *order_date*.
|
|
|
|
.. Select *Customize time interval*.
|
|
|
|
.. Change the *Minimum interval* to *1 days*.
|
|
|
|
.. In the *Display name* field, enter `Sale`, then click *Close*.
|
|
|
|
Add columns for each continent.
|
|
|
|
. From the *Available fields* list, drag *geoip.continent_name* to the *Columns* field in the layer pane.
|
|
+
|
|
[role="screenshot"]
|
|
image::images/lens_table_over_time.png[Date histogram table with groups for the customer count metric]
|
|
|
|
. Click *Save and return*.
|
|
|
|
[discrete]
|
|
=== Save the dashboard
|
|
|
|
Now that you have a complete overview of your ecommerce sales data, save the dashboard.
|
|
|
|
. In the toolbar, click *Save*.
|
|
|
|
. On the *Save dashboard* window, enter `Ecommerce sales`, then click *Save*.
|
|
|
|
. Select *Store time with dashboard*.
|
|
|
|
. Click *Save*.
|