Skip to content

Document using docvalue_fields to retrieve _size field from mapper size plugin #57103

@bczifra

Description

@bczifra

The mapper size plugin documentation notes that the _size field can be retrieved using script_fields like so:

  "script_fields": {
    "size": {
      "script": "doc['_size']"  
    }
  }

An alternative is to use docvalue_fields like so:

"docvalue_fields" : [
        {
            "field": "_size", 
            "format": "use_field_mapping" 
        }
    ]

This second option is helpful for situations where users may have dynamic scripting disabled. I'm not sure, but it my also perform better than the script fields option.

Metadata

Metadata

Assignees

Labels

:Search Foundations/MappingIndex mappings, including merging and defining field types>docsGeneral docs changesTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions