{"record":{"id":"a872629f6ed8885b","repo":"quickwit-oss/quickwit","slug":"timestamp-field-timestamp-field-path-should-be-a87262","errorCode":null,"errorMessage":"timestamp field `{timestamp_field_path}` should be a datetime field","messagePattern":"timestamp field `(.+?)` should be a datetime field","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs","lineNumber":124,"sourceCode":"        bail!(\"timestamp field `{timestamp_field_path}` should not start with a `.`\");\n    }\n    if timestamp_field_path.ends_with('.') {\n        bail!(\"timestamp field `{timestamp_field_path}` should not end with a `.`\");\n    }\n    let Some(timestamp_field_type) =\n        mapping_root_node.find_field_mapping_type(timestamp_field_path)\n    else {\n        bail!(\"could not find timestamp field `{timestamp_field_path}` in field mappings\");\n    };\n    if let FieldMappingType::DateTime(date_time_option, cardinality) = &timestamp_field_type {\n        if cardinality != &Cardinality::SingleValued {\n            bail!(\"timestamp field `{timestamp_field_path}` should be single-valued\");\n        }\n        if !date_time_option.fast {\n            bail!(\"timestamp field `{timestamp_field_path}` should be a fast field\");\n        }\n    } else {\n        bail!(\"timestamp field `{timestamp_field_path}` should be a datetime field\");\n    }\n    Ok(())\n}\n\nimpl From<DocMapper> for DocMapperBuilder {\n    fn from(default_doc_mapper: DocMapper) -> Self {\n        let partition_key_str = default_doc_mapper.partition_key.to_string();\n        let partition_key_opt: Option<String> = if !partition_key_str.is_empty() {\n            Some(partition_key_str)\n        } else {\n            None\n        };\n        let doc_mapping = DocMapping {\n            doc_mapping_uid: default_doc_mapper.doc_mapping_uid,\n            mode: default_doc_mapper.mode,\n            field_mappings: default_doc_mapper.field_mappings.into(),\n            timestamp_field: default_doc_mapper.timestamp_field_name,\n            tag_fields: default_doc_mapper.tag_field_names,","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs#L106-L142","documentation":"The timestamp field must be of `FieldMappingType::DateTime`. If `find_field_mapping_type` resolves the path but the field is any other type (text, u64, i64, etc.), the `if let` falls to the `else` branch and the DocMapper builder bails.","triggerScenarios":"Calling `DocMapperBuilder::try_from` with a `timestamp_field` that resolves to a non-datetime mapped field, e.g. `type: text` or `type: u64`.","commonSituations":"Configuring an epoch-seconds numeric field as timestamp_field assuming integers are acceptable; a type change in the mapping (datetime → text) leaving the old timestamp_field reference; copy-pasted index configs from other systems.","solutions":["Change the referenced field's type to `datetime` in the doc mapping.","Or add/repoint `timestamp_field` to an existing datetime field.","If the data is a numeric epoch, map the field as `datetime` with the matching `input_formats` (e.g. unix_ts_secs) instead of a plain integer type."],"exampleFix":"// before\ndoc_mapping:\n  field_mappings:\n    - name: ts\n      type: u64\n  timestamp_field: \"ts\"\n// after\ndoc_mapping:\n  field_mappings:\n    - name: ts\n      type: datetime\n      input_formats: [unix_ts_secs]\n  timestamp_field: \"ts\"","handlingStrategy":"validation","validationCode":"const f = findField(cfg.doc_mapping.field_mappings, cfg.doc_mapping.timestamp_field);\nif (f && f.type !== 'datetime') throw new Error(`timestamp_field \"${f.name}\" must be datetime, got ${f.type}`);","typeGuard":null,"tryCatchPattern":"match DocMapperBuilder::try_from(config) {\n    Ok(dm) => Ok(dm),\n    Err(e) if e.to_string().contains(\"should be a datetime field\") => Err(ConfigError::InvalidTimestampField(e.to_string())),\n    Err(e) => Err(e.into()),\n}","preventionTips":["Only assign datetime-typed fields as timestamp_field.","Map epoch numbers with type: datetime and proper input_formats instead of u64/i64.","Re-check timestamp_field after any mapping type migration."],"tags":["doc-mapping","timestamp","type-mismatch","config-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}