How you connect to Elasticsearch from within your plugin will depend on the type of plugin you are building:
If you are building a visualization plugin that plans to use Elasticsearch's aggregations and visualize the results, Kibana will handle the connection for you and abstract away the details.
If you want a more direct connection to Elasticsearch, that is also possible via the callWithRequest method provided by the Elasticsearch plugin in Kibana.
I recommend reading through the list of resources on the wiki page I linked to above, particularly Tim Roes' blog post, Writing Kibana 4 Plugins — he covers both types of connections to Elasticsearch that I've mentioned here. But please also see the other resources on the wiki page to get a more complete understanding and don't hesitate to chat with Kibana core developers in the #kibana IRC channel on Freenode.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.