Skip to content

Conversation

@masseyke
Copy link
Member

This adds a new field to each document response in the response of the simulate ingest API. The field is effective_mapping, and shows what the mapping would be for the index where the document would be indexed.

@masseyke masseyke added >enhancement :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v9.2.0 labels Aug 13, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Aug 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine
Copy link
Collaborator

Hi @masseyke, I've created a changelog YAML for you.

@lukewhiting lukewhiting requested a review from Copilot August 14, 2025 07:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new effective_mapping field to the simulate ingest API response that shows what the mapping would be for the index where each document would eventually be indexed. This enhancement helps users understand the final mapping structure that would apply to their documents after processing through ingest pipelines.

Key changes:

  • Added effective_mapping field to SimulateIndexResponse to track and serialize the effective mapping
  • Updated TransportSimulateBulkAction to calculate and include the effective mapping during validation
  • Added comprehensive test coverage for the new functionality including YAML REST tests

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
SimulateIndexResponse.java Added effective_mapping field with serialization support and transport version handling
TransportSimulateBulkAction.java Modified validation logic to capture and return effective mapping alongside existing validation results
TransportVersions.java Added new transport version constant for effective mapping feature
RestSimulateIngestActionTests.java Updated test cases to include effective mapping in expected responses
SimulateIndexResponseTests.java Added test coverage for effective mapping serialization and XContent output
TransportSimulateBulkActionTests.java Updated test expectations to include effective mapping field
80_ingest_simulate.yml Added comprehensive YAML REST test for effective mapping functionality with rerouting and data streams
132833.yaml Added changelog entry for the enhancement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

if (indicesWithInvalidMappings.contains(imd.getIndex().getName())) {
if (indicesWithInvalidMappings.contains(imd.getIndex().getName())
// We only want to throw exceptions inside TransportSimulateBulkAction:
&& invocation.getArgument(1).getClass().getSimpleName().contains("TransportSimulateBulkAction")) {
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

Using class name string comparison is fragile and could break if the class is renamed or moved. Consider using instanceof or a more robust type checking mechanism instead of relying on the simple class name.

Suggested change
&& invocation.getArgument(1).getClass().getSimpleName().contains("TransportSimulateBulkAction")) {
&& invocation.getArgument(1) instanceof TransportSimulateBulkAction) {

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@lukewhiting lukewhiting left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

@masseyke masseyke merged commit 768396d into elastic:main Aug 14, 2025
32 of 33 checks passed
@masseyke masseyke deleted the adding-simulate-ingest-effective-mapping branch August 14, 2025 19:41
szybia added a commit to szybia/elasticsearch that referenced this pull request Aug 15, 2025
* upstream/main: (32 commits)
  Speed up loading keyword fields with index sorts (elastic#132950)
  Mute org.elasticsearch.index.mapper.LongFieldMapperTests testSyntheticSourceWithTranslogSnapshot elastic#132964
  Simplify EsqlSession (elastic#132848)
  Implement WriteLoadConstraintDecider#canAllocate (elastic#132041)
  Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search/400_synthetic_source/_doc_count} elastic#132965
  Switch to PR-based benchmark pipeline defined in ES repo (elastic#132941)
  Breakdown undesired allocations by shard routing role (elastic#132235)
  Implement v_magnitude function (elastic#132765)
  Introduce execution location marker for better handling of remote/local compatibility (elastic#132205)
  Mute org.elasticsearch.cluster.ClusterInfoServiceIT testMaxQueueLatenciesInClusterInfo elastic#132957
  Unmuting simulate index data stream mapping overrides yaml rest test (elastic#132946)
  Remove CrossClusterCancellationIT.createLocalIndex() (elastic#132952)
  Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetch elastic#132956
  Fix failing UT by adding a required capability (elastic#132947)
  Precompute the BitsetCacheKey hashCode (elastic#132875)
  Adding simulate ingest effective mapping (elastic#132833)
  Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetchMany elastic#132948
  Rename skipping logic to remove hard link to skip_unavailable (elastic#132861)
  Store ignored source in unique stored fields per entry (elastic#132142)
  Add random tests with match_only_text multi-field (elastic#132380)
  ...
joshua-adams-1 pushed a commit to joshua-adams-1/elasticsearch that referenced this pull request Aug 15, 2025
szybia added a commit to szybia/elasticsearch that referenced this pull request Aug 15, 2025
…-stats

* upstream/main: (36 commits)
  Fix reproducability of builds against Java EA versions (elastic#132847)
  Speed up loading keyword fields with index sorts (elastic#132950)
  Mute org.elasticsearch.index.mapper.LongFieldMapperTests testSyntheticSourceWithTranslogSnapshot elastic#132964
  Simplify EsqlSession (elastic#132848)
  Implement WriteLoadConstraintDecider#canAllocate (elastic#132041)
  Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search/400_synthetic_source/_doc_count} elastic#132965
  Switch to PR-based benchmark pipeline defined in ES repo (elastic#132941)
  Breakdown undesired allocations by shard routing role (elastic#132235)
  Implement v_magnitude function (elastic#132765)
  Introduce execution location marker for better handling of remote/local compatibility (elastic#132205)
  Mute org.elasticsearch.cluster.ClusterInfoServiceIT testMaxQueueLatenciesInClusterInfo elastic#132957
  Unmuting simulate index data stream mapping overrides yaml rest test (elastic#132946)
  Remove CrossClusterCancellationIT.createLocalIndex() (elastic#132952)
  Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetch elastic#132956
  Fix failing UT by adding a required capability (elastic#132947)
  Precompute the BitsetCacheKey hashCode (elastic#132875)
  Adding simulate ingest effective mapping (elastic#132833)
  Mute org.elasticsearch.index.mapper.LongFieldMapperTests testFetchMany elastic#132948
  Rename skipping logic to remove hard link to skip_unavailable (elastic#132861)
  Store ignored source in unique stored fields per entry (elastic#132142)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >enhancement Team:Data Management Meta label for data/management team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants