Yes, you can just grab the query from the visualization and see how kibana is doing it.
2.4
Just go to Settings -> Objects -> visualizations and view the visualization that you want to replicate
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.