title: How to compute custom metrics using Elasticsearch + Kibana?
body: <p>It seems like a pretty easy question, but for some reason I still can't understand how to solve the same. I have an elastic search cluster which is using twitter river to download tweets. I would like to implement a sentiment analysis module which takes each tweet and computes a score (+ve/-ve) etc. I would like the score to be computed for each of the existing tweets as well as for new tweets and then visualize using Kibana.</p>
  
  <p>However, I am not sure where should I place the call to this sentiment analysis module in the elastic search pipeline.</p>
  
  <p>I have considered the option of modifying twitter river plugin but that will not work retrospectively.</p>
  
  <p>Essentially, I need to answer two questions :-
  1) how to call python/java code while indexing a document so that I can modify the json accordingly.
  2) how to use the same code to modify all the existing documents in ES.</p>