Pie chart

edit

Initially, the pie contains a single "slice." That’s because the default search matched all documents.

tutorial visualize pie 1

To specify which slices to display in the pie, you use an Elasticsearch bucket aggregation. This aggregation sorts the documents that match your search criteria into different categories, also known as buckets.

Use a bucket aggregation to establish multiple ranges of account balances and find out how many accounts fall into each range.

  1. In the Buckets pane, click Split Slices.
  2. In the Aggregation dropdown menu, select Range.
  3. In the Field dropdown menu, select balance.
  4. Click Add Range four times to bring the total number of ranges to six.
  5. Define the following ranges:

    0             999
    1000         2999
    3000         6999
    7000        14999
    15000       30999
    31000       50000
  6. Click Apply changes apply changes button.

Now you can see what proportion of the 1000 accounts fall into each balance range.

tutorial visualize pie 2

Add another bucket aggregation that looks at the ages of the account holders.

  1. At the bottom of the Buckets pane, click Add sub-buckets.
  2. In Select buckets type, click Split Slices.
  3. In the Sub Aggregation dropdown, select Terms.
  4. In the Field dropdown, select age.
  5. Click Apply changes apply changes button.

Now you can see the break down of the ages of the account holders, displayed in a ring around the balance ranges.

tutorial visualize pie 3

To save this chart so you can use it later:

  • Click Save in the top menu bar and enter Pie Example.