I don't think that's possible right now, in a normal visualization, but you can accomplish it with Canvas: https://www.elastic.co/guide/en/kibana/current/canvas.html
Canvas allows you to write a pretty unique combination of queries, and then bind it to visualizations.