I'm trying to build a heatmap in Vega. I can't build it in the normal heatmap visualization because I need each cell to be a ratio.

I have 3 fields, X from 0 to 9, Y from 0 to 9 and Z with values 0 or 1.

My goal is to build a heat map where the value of each cell is the ratio of all [X,Y] where Z==1 divided by all [X,Y].

So I do the following query: "GET logstash-/_search?q=X:0 AND Y:0 AND Z:1" and the hits.total is the numerator value I'm looking for. And if I do this one: "GET logstash-/_search?q=X:0 AND Y:0" I get the denominator.

Is there a way of using the ratio of all the 100 combinations I get to build the heatmap?

Is there a simple example of building a heatmap with vega that I could follow? The only one I found is a bit complicated.

@Mike_CC if your entire elasticsearch index contains just 200 documents (x-10 * y-10 * z-2), you can just load them all (i.e. all documents that contain x,y, and z fields), and then use the same approach as shown in https://vega.github.io/vega/examples/heatmap/ . If your data is much bigger, you need to construct your query in such a way as to produce those 200 documents.

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.