Connecting Tableau to Elasticsearch

If you have ever wondered how we can connect Tableau to Elasticsearch, this blog post should be of some interest to you.

As of Sep 2016, there is no native Elasticsearch connector provided by either Elastic or Tableau, but here’s a tool someone put together which seems to work but require some effort on the part of your friendly Windows/Unix administrator. (It’s recommended by my local Tableau engineer.)

The Tableau to Greenplum connection is just ODBC/JDBC so that part is easy. This reduces the problem of connecting Tableau to Elasticsearch to the problem of connecting Greenplum to Elasticsearch, and that turns out to be straightforward too: In Greenplum, one can create a so-called External Web Table that allows you to run an arbitrary script, and _that_ script can be a call to Elasticsearch.

Here’s a simple example.

Suppose you have indexed the OpenAddresses database in an Elasticsearch index called address_database, which is accessible through a server called esnode on port 9200. You can easily interact with that Elasticsearch server via a command like

curl $GET 'esnode:9200/address_database/_search?q=myquerystring'

Now we just need to set that up inside a Greenplum external web table, with the query string parameterised via meta-programming. There are different ways to do this, and this is how it looks in PL/pgSQL.

Now, with a custom SQL query in Tableau, you can visualise Elasticsearch data in Tableau. You can now also join existing tables in Greenplum with data from Elasticsearch in the same SQL query.

Of course, once data land in Tableau, you can do much more fancy visualisations than what is available in Kibana. Also, now you can export data to a CSV from Tableau if you want, a feature that is still not available in Kibana.