Skip to content

Term vectors for nested fields #91902

@Barabanga

Description

@Barabanga

Elasticsearch Version

7.14.2

Installed Plugins

No response

Java Version

openjdk version "1.8.0-262" OpenJDK Runtime Environment (build 1.8.0-262-b10) OpenJDK 64-Bit Server VM (build 25.71-b10, mixed mode)

OS Version

windows 10

Problem Description

Using the mtermvectors api to get the term vectors (with term_statistics) for an artificial document Elasticsearch will ignore the nested fields.

Steps to Reproduce

To reproduce:
Create the index and upload a doc

PUT /my-index-000001
{
  "mappings": {
    "properties": {
      "user": {
        "type": "nested",
        "properties": {
            "first" :  {
                "type": "text"
            },
            "last" :  {
                "type": "text"
            },
            "description":{
                "type": "text"
            }
        }
      }
    }
  }
}
PUT /my-index-000001/_doc/1
{
  "group" : "fans",
  "user" : [
    {
      "first" : "John",
      "last" :  "Smith",
      "description":"first description"
    },
    {
      "first" : "Alice",
      "last" :  "White",      
      "description":"second description"
    }
  ]
}

Request the term vector for an artificial document

GET my-index-000001/_mtermvectors
{ 
   "docs": [ 
    { 
        "doc" : {
            "group":"test",
            "user" : [
                {
                "first" : "John",
                "last" :  "Smith",
                "description":"artificial description"
                }
            ]
        }, 
        "fields": ["*"], 
        "term_statistics":true,
        "positions":false,
        "offsets":false
    }
   ]
}

Response

{
    "docs": [
        {
            "_index": "my-index-000001",
            "_type": "_doc",
            "_version": 0,
            "found": true,
            "took": 0,
            "term_vectors": {
                "group": {
                    "field_statistics": {
                        "sum_doc_freq": 1,
                        "doc_count": 1,
                        "sum_ttf": 1
                    },
                    "terms": {
                        "test": {
                            "term_freq": 1
                        }
                    }
                }
            }
        }
    ]
}

The response does not include the term vector for the nested field.

Logs (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Relevance/SearchCatch all for Search Relevance>bugTeam:Search RelevanceMeta label for the Search Relevance team in Elasticsearchpriority:normalA label for assessing bug priority to be used by ES engineers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions