-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Term vectors query returns nothing in nested inner objects if term vectors are stored in the index #21625
Description
Elasticsearch version: 5.0.0, 2.4.1
Plugins installed: []
JVM version: 1.8.0_112-b15 64-bit
OS version: Windows 10 v. 1607 (build 14393.447)
Description of the problem including expected versus actual behavior:
When making a _termvectors query to an object in a "type": "nested" field, response is returned with "term_vectors" : { } if vectors are stored ("store": true 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.
Steps to reproduce:
PUT /mcve
2. PUT /mcve/ex/_mapping
{
"properties": {
"parent": {
"type": "nested",
"properties": {
"value": {"type": "text", "term_vector": "with_positions_offsets", "store": true}
}
}
}
}
3. PUT /mcve/ex/ample
{
"parent": {
"value": "hello world"
}
}
4. PUT /mcve/ex/ample/_termvectors
{
"fields": ["parent.value"]
}
Response:
{
"_index" : "mcve",
"_type" : "ex",
"_id" : "ample",
"_version" : 1,
"found" : true,
"took" : 1,
"term_vectors" : { }
}
However, if I disable storing term vectors by changing this line in mapping:
"value": {"type": "text", "term_vector": "with_positions_offsets", "store": true}
to this:
"value": {"type": "text"}
the result will be:
{
"_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... */
}
}
}
}
But highlighting queries will be slower (tested on a ~80 MB index with ~600 documents), as if term vectors were in fact built previously.
Provide logs (if relevant):
--