Skip to content

Conversation

@gmarouli
Copy link
Contributor

In this PR we add a check that will reject the following mapping:

PUT my-index-2
{
  "mappings": {
    "properties": {
      "attributes": {
          "type": "passthrough",
          "time_series_dimension": true,
          "priority": 20,
          "properties": {
            "attributes.kube_job_status_active": {
              "type": "double",
              "time_series_metric": "gauge"
            }
          }
      }
    }
  }
}

This mapping was rejected when assertions were enabled, but on production environments it was not checked properly.

The problem is that we were checking that a field cannot be both a dimension and a metric during parsing. When the mapping is first parsed the attributes.kube_job_status_active does not explicitly list "time_series_dimension": true so it passes the check, then during building the mappers we do add it but we do not recheck it then.

Now we check this when we build a NumberFieldMapper.

Fixes: #138044

@gmarouli gmarouli requested a review from kkrik-es November 19, 2025 16:12
@gmarouli gmarouli added >bug auto-backport Automatically create backport pull requests when merged :StorageEngine/Mapping The storage related side of mappings branch:9.2 branch:9.1 branch:8.19 labels Nov 19, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

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

Nice, that was quick.

@gmarouli gmarouli merged commit 33ebf40 into elastic:main Nov 20, 2025
34 checks passed
@gmarouli gmarouli deleted the fix-mapping-validation-for-dimension-metric-conflict branch November 20, 2025 06:43
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Nov 20, 2025
gmarouli added a commit to gmarouli/elasticsearch that referenced this pull request Nov 20, 2025
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.2
8.19
9.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged >bug :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine v8.19.8 v9.1.8 v9.2.2 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid passthrough object the mixes dimensions and metrics fields

3 participants