Visualize Real Time Twitter Sentiment Analysis Elastic Search and Kibana

Before you start following this tutorial, make sure you have read earlier blog about how to do real time sentiment analysis using spark. Now, if you have followed the blog you will see at the end of code we are pushing data to elastic search.
temp.saveJsonToEs("eclipse/test") // Writing to ElasticSearch
Prerequisites:
  • Install Elasticsearch ( open source )
  • Install Kibana ( open source)
To push the data to elastic search, you need to include the jar dependency for Elasticsearch. Download Elastic search dependency.

Make sure to import following libraries.
import org.elasticsearch.spark._
import org.elasticsearch.spark.streaming._
We have two ways to push data to elastic search:
  • In JSON format
  • In Map RDD format
We do not have to create index before pushing data. This syntax will create index on the fly. If you want to do manual mappings than you first have to create index with appropriate mappings. To do manual mappings, follow these instructions.

Create a visualization in kibana
  1. Start elasticsearch and kibana.
  2. Go to kibana dashboard on default port 5601.
  3. Click on visualization tab and now click on vertical bar.
  4. Keep the setting as shown in the image.
  5. Go to dashboard and create a new dashboard.
  6. click on add to add a new visualization on dashboard.


Now you can change the settings in newly created kibana dashboard to make it auto refresh every 5 seconds.

Start the streaming and your graph will get updated in real time.

Comments

Popular posts from this blog

Speed Up Pandas .to_sql to Insert Data - 100x Faster ( Using SQLalchemy)

Real Time Twitter Sentiment Analysis Using Spark ,Twitter Streaming API and write to Elastic Serach