Discover and Visualise the data in Kibana
Amazon ElasticSearch comes with the Kibana plugin installed to assist you in visualising and analysing your data. Because of the way the security model works, all calls into the Elastic Search cluster, including connecting to Kibana, must be signed with credentials. For us to connect to Kibana we need to either sign the request which the browser can’t do or we need to open it to our IP. Let’s do the latter and add our IP to the cluster security policy.
Go to your Amazon ElasticSearch Cluster in the AWS Console.
Once you selected your cluster, go to Actions and Modify access policy.
You’ll see a JSON defined for you. Find the part with Condition and IpAddress and change it to the following (X.X.X.X reflect the previous value, please keep it):
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"X.X.X.X",
"<ADD YOUR PUBLIC IP OR RANGE>"
]
}
}
You can either use https://checkip.amazonaws.com/ to identify your IP, or use some other tools like curl ifconfig.me
After you changed the Policy, you can click on the Kibana link in the overview tab.
You will see the Kibana loading page while things are setup - it will only take a moment.
Kibana will then automatically find the timestamp field in our transactions index. Click Create to confirm.
You should now see much more data!
In this step, we will visualise and analyse the sales data using Kibana.
In step 2, select From a new search
Initially, you will see a pie chart that is a full circle made up of only one slice. We need to filter our data. Click Split Slices.
For Aggregation select Terms
For Field select productType
For Size type 5
Click the Play Icon at the top of the left-side panel to re-render the graph:
Your dataset will be different (due to the randomly-selected transactions and their details) but you will see a result similar to that shown here. In this example, *Eyewear* is the top moving product in the time period selected (Last 5 years).
Terms
retailerType
Again, your data will be different, but in this example, we can see the breakdown of the count of transactions at each of the retailer types, for each of the top selling product types.
As you can see, Kibana is a very powerful tool for analysing your data. Take some time to experiment with other graph types, fields and aggregations. You can save each visualisation you create, and then add them to a dashboard using the tools and icons in the Kibana web page.
If you need to clear the records, mappings and index from the ElasticSearch domain, you can issue the following from a terminal window:
curl -XDELETE https://<ElasticsearchEndpoint>/transactions -k
But replace with the ElasticsearchEndpoint value from from Cloudformation Outputs tab.
You will then need to re-create the mappings, by running the mappings command you ran earlier. You can then re-populate your data set by running the Consumer and Producer applications again.