title: How to query + Reindex in AWS hosted Elasticsearch outside of Kibana
body: <p>I have a problem in which I need to query for a subset of records on a large index containing a high volume of records, whilst running a Painless script with the search query to augment the result. The (much smaller) result is to be saved in a secondary index for later use. In a different SO question: <a href="https://stackoverflow.com/questions/51072212/reindex-part-of-elasticsearch-index-onto-new-index-via-jest">Reindex part of Elasticsearch index onto new index via Jest</a>, I mentioned this is possible through the Kibana interface, but there does not seem to be a Java library that can accomplish what I need. Has anyone ever accomplished a query within a _reindex operation outside of Kibana? I am leaning toward using the URLConnection family in Java, but am looking for suggestions and advice at this point.</p>