title: How to return partial doc from Elasticsearch query/filter?
body: <p>I have a set of docs (let's call them <code>books</code>), which have a subset of information (let's say <code>editions</code>), for a data structure somewhat akin to this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"book": {
      "author": "A. N. Author",
      "title": "Fantastic Queries and How to Index Them"
      "editions": [
          {
            "publisher":"penguin",
            "isbn": 124161256653,
            "coverArtist":"Pain T Brush",
            "amazonPrice":65.50
          },
          {
            "publisher":"orbit",
            "isbn": 124163526653,
            "coverArtist":"Pain T Brush",
            "amazonPrice":25.99
          },
          {
            "publisher":"tor",
            "isbn": 124169876353,
            "coverArtist":"Pen See Il",
            "amazonPrice":700.00
          }
      ]
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Right now with the queries I have (which search on <code>editions.publisher</code> or <code>editions.isbn</code>), I get the whole document back, including editions that don't match the query results. So, to be clear, if I search <code>coverArtist</code> for <code>Pain T Brush</code>, the data I want returned is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"book": {
      "author": "A. N. Author",
      "title": "Fantastic Queries and How to Index Them"
      "editions": [
          {
            "publisher":"penguin",
            "isbn": 124161256653,
            "coverArtist":"Pain T Brush",
            "amazonPrice":65.50
          },
          {
            "publisher":"orbit",
            "isbn": 124163526653,
            "coverArtist":"Pain T Brush",
            "amazonPrice":25.99
          }
      ]
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Same with the other queries. If I search for a specific <code>isbn</code>, I only want its data to come back. If I set a price range of <code>&gt; 500</code>, I'd only want the last edition (along with the author and title information, of course). And finally, if I search for <code>Fantastic Queries and How to Index Them</code> in the <code>title</code>, I want the whole doc returned, with all edition information, since I didn't specify anything edition-specific.</p>
  
  <p>I'm unaware of a way to make the queries 'drill down' into particular objects in a doc, so is this even possible?</p>