I have created an Elasticsearch plugin for sentiment-analysis using Stanford CoreNLP libraries. The plugin is compatible with Elasticsearch 6.4.1.
Follow the below steps to use this plugin with your elasticsearch server:
1. Install the plugin
Windows:
bin\elasticsearch-plugin install https://github.com/TechnocratSid/elastic-sentiment-analysis-plugin/releases/download/6.4.1/elastic-sentiment-analyis-plugin-6.4.1.zip
Unix:
sudo bin/elasticsearch-plugin install https://github.com/TechnocratSid/elastic-sentiment-analysis-plugin/releases/download/6.4.1/elastic-sentiment-analyis-plugin-6.4.1.zip
2. Starting Elasticsearch
How you start Elasticsearch depends on how you installed it. I’ve installed Elasticsearch on Windows with a .zip package, in my case I can start Elasticsearch from the command line using the following command:
.\bin\elasticsearch.bat
Note: To setup Elasticsearch follow the link Set up Elasticsearch.
3. Open Kibana
Perform the request mentioned below:
Example1:
POST _sentiment
{
"text" : "He is very happy"
}
Output:
{
"sentiment_score": 3,
"sentiment_type": "Positive",
"very_positive": "38.0%",
"positive": "59.0%",
"neutral": "2.0%",
"negative": "0.0%",
"very_negative": "0.0%"
}
Example2:
POST _sentiment
{
"text" : "He is bad"
}
Output:
{
"sentiment_score": 1,
"sentiment_type": "Negative",
"very_positive": "1.0%",
"positive": "2.0%",
"neutral": "13.0%",
"negative": "66.0%",
"very_negative": "19.0%"
}
If you don’t want to use kibana use curl instead.
If you want to hack into the code check out the github link.