It's not very clear what your goals are. Seems that you access index1 because that's the selected index pattern for your visualization, but is the index2 name supposed to be hardcoded in your controller for a follow-up query? Is the goal going to be to join data from the initial response with data from index2?
Then you can call methods off the client, for example es.get(). You can refer to the documentation for the available methods and the options they take. Index name is usually a field you can supply in the params.
Sorry for the delayed response - my email notifications were not coming in.
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.