title: Nested documents in ElasticSearch without mapping types
body: <p>With the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/removal-of-types.html" rel="nofollow noreferrer">planned removal of mapping types</a> coming to ElasticSearch, does this also mean the deprecation of nested documents and nested queries? How would/will ElasticSearch support queries of nested objects in typeless context?</p>
  
  <p>The functionality I'm considering is being able to return only the hits in a nested array that match search criteria.</p>
  
  <p><strong>Edit 1</strong>: Example mapping + query in ElasticSearch version 6</p>
  
  <p><strong>ElasticSearch 6 Mapping</strong></p>
  
  <pre><code>{
      "rec": {
          "mappings": {
              "history": {
                  "properties": {
                      "dateCompleted": {
                          "type": "keyword"
                      },
                      "dateCreated": {
                          "type": "keyword"
                      },
                      "dateOrdered": {
                          "type": "keyword"
                      },
                      "dateToArrive": {
                          "type": "keyword"
                      },
                      "details": {
                          "type": "nested",
                          "properties": {
  
                              "clientId": {
                                  "type": "keyword"
                              },
                              "company": {
                                  "type": "text",
                                  "fields": {
                                      "keyword": {
                                          "type": "keyword",
                                          "ignore_above": 256
                                      }
                                  }
                              },
                              "orderNumber": {
                                  "type": "text",
                                  "fields": {
                                      "keyword": {
                                          "type": "keyword",
                                          "ignore_above": 256
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>ElasticSearch 6 Query</strong></p>
  
  <pre><code>{
    "from": 0,
    "query": {
      "nested": {
        "inner_hits": {},
        "path": "details",
        "query": {
          "bool": {
            "must": [
              {
                "match_phrase": {
                  "details.company.keyword": {
                    "query": "ABCD"
                  }
                }
              }
            ]
          }
        }
      }
    },
    "size": 10,
    "sort": [],
    "_source": false
  }
  </code></pre>