Skip to content

[Transform] mapper cannot be changed from type [long] to [float] #67148

@przemekwitek

Description

@przemekwitek

It happens that the latest transform fails with the following error:

      "reason" : "Failed to index documents into destination index due to permanent error [org.elasticsearch.xpack.transform.transforms.BulkIndexingException: Bulk index experienced [1] failures and at least 1 irrecoverable [mapper [products.min_price] cannot be changed from type [long] to [float]]. Other failures:; java.lang.IllegalArgumentException: mapper [products.min_price] cannot be changed from type [long] to [float]]",

Steps to reproduce:

  1. Start Kibana
  2. Load kibana_sample_data_ecommerce dataset
  3. Go to "Dev Tools"
  4. Create a transform:
PUT _transform/debug_mappings
{
  "source": {
    "index": [ "kibana_sample_data_ecommerce" ]
  },
  "dest": {
    "index": "ecommerce_dest"
  },
  "latest": {
    "unique_key": [ "category.keyword" ],
    "sort": "order_date"
  }
}
  1. Start the transform:
POST _transform/debug_mappings/_start
  1. Get transform stats:
GET _transform/debug_mappings/_stats

The reason for this error is that the products.min_price mapped type in the source index is half_float but the field value is sometimes an integer.
Then, due to dynamic mappings in the destination index, the products.min_price gets mapped as long and cannot be further changed from long to float.

Workaround:
Create destination index mappings explicitly (at least for this one problematic field):

PUT ecommerce_dest
{
  "mappings": {
    "properties": {
      "products": {
        "properties": {
          "min_price": {
            "type": "float"
          }
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions