Skip to content

[Feature Request] Retrieve value from DocValues in a flat_object filed #16742

@kkewwei

Description

@kkewwei

Is your feature request related to a problem? Please describe

It's is known that we can get value from DocValues. When the document has a high number of fields, and we just want to retrieve one/two field, DocValues performs better than stored fields.
https://sease.io/2020/03/docvalues-vs-stored-fields-apache-solr-features-and-performance-smackdown.html

But DocValues doesn't work in flat_object filed.

Example:

PUT /test-index/
{
  "mappings": {
    "properties": {
      "issue": {
        "type": "flat_object"
      }
    }
  }
}

PUT /test-index/_doc/1
{
  "issue": {
    "number": "123456",
    "labels": {
      "version": "2.1",
      "backport": [
        "2.0",
        "1.3"
      ],
      "category": {
        "type": "API",
        "level": "enhancement"
      }
    }
  }
}

GET test-index/_search
{
    "stored_fields": "_none_",
    "docvalue_fields":["issue.number"]
}

image
issue.number is not in the result.

Describe the solution you'd like

As we have store DocValues for flat_object filed, we should retrieve value from DocValues in flat_object filed when necessary. I'm pleasure to implement it.

Related component

Storage:Performance

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingenhancementEnhancement or improvement to existing feature or requestuntriaged

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions