<p dir="auto">Right now the bats tests install elasticsearch on a clean system. They should also test that the packages can be upgraded without losing data. Both across major and minor versions.</p>
<p dir="auto"><strong>Elasticsearch version</strong>: 5.0.0, 2.4.1</p>
<p dir="auto"><strong>Plugins installed</strong>: []</p>
<p dir="auto"><strong>JVM version</strong>: 1.8.0_112-b15 64-bit</p>
<p dir="auto"><strong>OS version</strong>: Windows 10 v. 1607 (build 14393.447)</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behavior</strong>:</p>
<p dir="auto">When making a <code class="notranslate">_termvectors</code> query to an object in a <code class="notranslate">"type": "nested"</code> field, response is returned with <code class="notranslate">"term_vectors" : { }</code> if vectors are stored (<code class="notranslate">"store": true</code> in mapping). If the object isn't nested or term vectors aren't stored, the object returned is filled properly (examples below). When TV storing is enabled then despite the fact that I'm unable to retrieve them, highlighting seems to be significantly faster, as if term vectors were present.</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li><code class="notranslate">PUT /mcve</code></li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2.  PUT /mcve/ex/_mapping
    {
      &quot;properties&quot;: {
        &quot;parent&quot;: {
          &quot;type&quot;: &quot;nested&quot;,
          &quot;properties&quot;: {
            &quot;value&quot;: {&quot;type&quot;: &quot;text&quot;, &quot;term_vector&quot;: &quot;with_positions_offsets&quot;, &quot;store&quot;: true}
          }
        }
      }
    }"><pre class="notranslate"><code class="notranslate">2.  PUT /mcve/ex/_mapping
    {
      "properties": {
        "parent": {
          "type": "nested",
          "properties": {
            "value": {"type": "text", "term_vector": "with_positions_offsets", "store": true}
          }
        }
      }
    }
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="3.  PUT /mcve/ex/ample
    {
      &quot;parent&quot;: {
        &quot;value&quot;: &quot;hello world&quot;
      }
    }"><pre class="notranslate"><code class="notranslate">3.  PUT /mcve/ex/ample
    {
      "parent": {
        "value": "hello world"
      }
    }
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="4.  PUT /mcve/ex/ample/_termvectors
    {
      &quot;fields&quot;: [&quot;parent.value&quot;]
    }"><pre class="notranslate"><code class="notranslate">4.  PUT /mcve/ex/ample/_termvectors
    {
      "fields": ["parent.value"]
    }
</code></pre></div>
<p dir="auto">Response:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;_index&quot; : &quot;mcve&quot;,
  &quot;_type&quot; : &quot;ex&quot;,
  &quot;_id&quot; : &quot;ample&quot;,
  &quot;_version&quot; : 1,
  &quot;found&quot; : true,
  &quot;took&quot; : 1,
  &quot;term_vectors&quot; : { }
}"><pre class="notranslate"><code class="notranslate">{
  "_index" : "mcve",
  "_type" : "ex",
  "_id" : "ample",
  "_version" : 1,
  "found" : true,
  "took" : 1,
  "term_vectors" : { }
}
</code></pre></div>
<p dir="auto">However, if I disable storing term vectors by changing this line in mapping:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;value&quot;: {&quot;type&quot;: &quot;text&quot;, &quot;term_vector&quot;: &quot;with_positions_offsets&quot;, &quot;store&quot;: true}"><pre class="notranslate"><code class="notranslate">"value": {"type": "text", "term_vector": "with_positions_offsets", "store": true}
</code></pre></div>
<p dir="auto">to this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;value&quot;: {&quot;type&quot;: &quot;text&quot;}"><pre class="notranslate"><code class="notranslate">"value": {"type": "text"}
</code></pre></div>
<p dir="auto">the result will be:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;_index&quot; : &quot;mcve&quot;,
  &quot;_type&quot; : &quot;ex&quot;,
  &quot;_id&quot; : &quot;ample&quot;,
  &quot;_version&quot; : 1,
  &quot;found&quot; : true,
  &quot;took&quot; : 60,
  &quot;term_vectors&quot; : {
    &quot;parent.value&quot; : {
      &quot;field_statistics&quot; : {
        &quot;sum_doc_freq&quot; : 2,
        &quot;doc_count&quot; : 1,
        &quot;sum_ttf&quot; : 2
      },
      &quot;terms&quot; : {
        /* ...snip... */
      }
    }
  }
}"><pre class="notranslate"><code class="notranslate">{
  "_index" : "mcve",
  "_type" : "ex",
  "_id" : "ample",
  "_version" : 1,
  "found" : true,
  "took" : 60,
  "term_vectors" : {
    "parent.value" : {
      "field_statistics" : {
        "sum_doc_freq" : 2,
        "doc_count" : 1,
        "sum_ttf" : 2
      },
      "terms" : {
        /* ...snip... */
      }
    }
  }
}
</code></pre></div>
<p dir="auto">But highlighting queries will be slower (tested on a ~80 MB index with ~600 documents), as if term vectors were in fact built previously.</p>
<p dir="auto"><strong>Provide logs (if relevant)</strong>:</p>
<p dir="auto">--</p>
<p dir="auto"><a href="http://stackoverflow.com/q/40527963/1937994" rel="nofollow">Related SO question</a></p>