Skip to content

Fields API misses token_count fields inside nested fields #68983

Open
@cbuescher

Description

@cbuescher

This is an issue that came up during work on #67432 and was decided to treat as a follow-up issue.
As of 7.11 (that is before #67432) we are missing fields mapped as token_count if they are inside nested fields.

e.g.

DELETE my-index

PUT my-index
{
  "mappings": {
    "properties": {
      "obj": {
        "type": "nested",
        "properties": {
          "name": {
            "type": "text",
            "fields": {
              "length": {
                "type": "token_count",
                "analyzer": "standard"
              }
            }
          }
        }
      }
    }
  }
}

PUT /my-index/_doc/1
{
  "obj": {"name" : "Long John Silver"}
}

POST /my-index/_search
{
  "_source": false,
  "fields" : ["*"]
}

is missing the obj.name.length field which is there if e.g. obj is a regular object field. This is probably due to the fact that the value fetcher used by that field type is a DocValueFetcher and not the usual SourceValueFetcher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations 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