Can you nest queries logically in ElasticSearch, so the output of one query is the input to another query. Another, way to ask is how can I chain or pipe queries together?>
That is totally correct, you must programm a subquery in your favorite programming language. An example can be found here:
http://www.sebastianviereck.de/en/elasticsearch-subquery-scoring-optimization/