Overall view of Query Structure anywhere? Does the jigsaw have a picture on the box lid?

I was wondering if there is an overall view of how the various aspects of constructing queries fit together somewhere. The docs deal with each subject individually, often with orphaned code snippet examples that don't show where they fit into the structure. Its like trying to put together a thousand piece jigsaw without a picture on the box lid. I am resorting to finding code samples elsewhere and counting the number of spaces before configuration terms to calculate the indent level to work out where they fit in the structure.

An overview would be nice covering - which query types can fit together and which can't, where does filtering and aggregation fit in, and a way of "seeing" in our heads the structure so we can then build the queries on screen without "bodging about" and tial and error.

The json method of defining queries was probably a good idea in the beginning, but as more and more functionality has been added it has become unweildy.

Have you found the box lid? Willing to share the view of the overall structure?

Have you read through The Definitive Guide? The book was written in a manner that provides more of a top-down, narrative approach. It starts from "first principles" of ES, then discusses how queries and filters compose, how to think about structuring data, how to modify scoring to fit various requirements, etc etc.

Parts of the book are a bit out of date (we're working on updating it currently), but the overall content is still correct...just minor syntax issues that need clearing up.

The tl;dr: of query composition is actually very simple: compound queries (e.g. bool) can accept any query as a sub-query, including other bools. And any query (match, term, range, wildcard, etc) can be embedded into any location that accepts a query (the top-level query parameter, inside a bool, etc)