Skip to content

[DOC] Add documentation for Derived Source Keep Feature #12545

Description

@praveenvenkat06

What do you want to do?

  • Request a change to existing documentation
  • Add new documentation
  • Report a technical problem with the documentation
  • Other

Tell us about your request

Add documentation for the derived_source_keep field mapping parameter that controls source reconstruction for derived fields.

This parameter has two modes:

  • none (default): Uses doc values for source reconstruction. Doc values deduplicate values and may reorder arrays.
  • arrays: Enables stored fields to preserve exact array structures, including original order and duplicate values.

Documentation should cover:

  • Configuration syntax.
  • Supported field types:
    • keyword
    • boolean
    • ip
    • Numeric (long, integer, short, byte, double, float, half_float)
    • date
  • Behavior differences between modes.
  • Usage examples demonstrating preservation of array order and duplicates.

Version

3.8.0+

What other resources are available?

Steps for Testing

1. Create an index with derived_source_keep

PUT /test-index
{
  "mappings": {
    "properties": {
      "tags": {
        "type": "keyword",
        "derived_source_keep": "arrays"
      }
    }
  }
}

2. Index a document containing an array

POST /test-index/_doc/1
{
  "tags": [
    "opensearch",
    "search",
    "opensearch",
    "analytics",
    "search"
  ]
}

3. Retrieve the document

GET /test-index/_doc/1

Expected Result

The tags array should preserve its original structure and ordering:

{
  "_source": {
    "tags": [
      "opensearch",
      "search",
      "opensearch",
      "analytics",
      "search"
    ]
  }
}

Verification: The array maintains its original order and preserves duplicate values (opensearch appears twice and search appears twice).

Key Points for Documentation

  • When derived_source_keep: "arrays" is set, the field automatically enables store: true.
  • This increases index size but preserves exact array semantics.
  • This option is essential for use cases requiring exact array order and duplicate preservation.

Metadata

Metadata

Labels

Backlog - DEVDeveloper assigned to issue is responsible for creating PR.v3.8.0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions