Skip to content

Check field storage when synthetic source is enabled, in tests#139715

Merged
Kubik42 merged 1 commit intoelastic:mainfrom
Kubik42:field-storage-verifier-in-tests
Dec 18, 2025
Merged

Check field storage when synthetic source is enabled, in tests#139715
Kubik42 merged 1 commit intoelastic:mainfrom
Kubik42:field-storage-verifier-in-tests

Conversation

@Kubik42
Copy link
Copy Markdown
Contributor

@Kubik42 Kubik42 commented Dec 17, 2025

Currently, when testing field mappers against synthetic source, we rarely check if fields are stored appropriately and not double stored. This has led to regressions in releases and in serverless that go unnoticed; the most recent example being #139415.

FieldStorageVerifier aims to help with that by providing a simple API that can be leveraged to verify that a field is stored exactly where we expect it to. The class itself looks for all instances of a given field in a given document. If said instances don't match expectations, it complains.

Example use case:

FieldStorageVerifier.forField("name", doc.rootDoc())
    .expectDocValues()
    .verify();

Will verify that name is only stored in doc_values. If name is stored anywhere else, like ignored_source or a StoredField, then the verification check will fail. Furthermore, if name is stored twice in doc_values, as with fallback fields, the check will also fail. This helps us confirm:

  • name is not doubled stored
  • name is stored in the expected place; in this case doc_values

I've updated TextFieldMapperTests for now, with more field mappers to follow in future PRs.

This closes #139550

@Kubik42 Kubik42 force-pushed the field-storage-verifier-in-tests branch from 0a947b2 to da9e904 Compare December 17, 2025 21:46
@Kubik42 Kubik42 marked this pull request as ready for review December 17, 2025 23:16
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx for including this in our test coverage!

@Kubik42 Kubik42 merged commit 80d424f into elastic:main Dec 18, 2025
33 of 35 checks passed
@Kubik42 Kubik42 deleted the field-storage-verifier-in-tests branch December 18, 2025 16:01
szybia added a commit to szybia/elasticsearch that referenced this pull request Dec 19, 2025
* upstream/main: (253 commits)
  Adds ST_SIMPLIFY geo spatial function (elastic#136309)
  Take control of max clause count verification in Lucene searcher (elastic#139752)
  [ML] Unmute Inference Test (elastic#139765)
  Parameterize the vector operation benchmark tests (elastic#139735)
  Fix node reduction pushdown tests for release tests (elastic#139548)
  Fix flakiness in TSDataGenerationHelper (elastic#139759)
  CPS: Copy existing resolved index expressions when constructing a new `SearchRequest` from an existing one (elastic#139596)
  Add release notes for v9.1.9 release (elastic#139674)
  Add lucene query for wildcards on high cardinality keyword fields. (elastic#139746)
  Suppress Tika entitlement warnings from AWT (elastic#139711)
  Check field storage when synthetic source is enabled, in tests (elastic#139715)
  Refactor VectorSimilarityType to know about its corresponding Function (elastic#139678)
  Merge fixes from patch branch back into main (elastic#139721)
  Define native bulk operations for vector square distance (elastic#139198)
  Use LongUpDownCounter for Linked Project Error Metrics (elastic#139657)
  ESQL: Add javadoc that explains version-aware planning (elastic#139706)
  Add helper to pick node for reindex relocation (elastic#139081)
  Fix auth serialization randomized version test (elastic#139182)
  ES|QL - Add parsing, preanalysis and analysis timing information to profile (elastic#139540)
  Mute org.elasticsearch.persistent.ClusterPersistentTasksCustomMetadataTests testMinVersionSerialization elastic#139741
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand verification in synthetic source tests to avoid double storing fields

3 participants