{"record":{"id":"5420f5ba11b2d068","repo":"quickwit-oss/quickwit","slug":"timestamp-field-timestamp-field-path-should-be","errorCode":null,"errorMessage":"timestamp field `{timestamp_field_path}` should be single-valued","messagePattern":"timestamp field `(.+?)` should be single-valued","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs","lineNumber":118,"sourceCode":"\nfn validate_timestamp_field(\n    timestamp_field_path: &str,\n    mapping_root_node: &MappingNode,\n) -> anyhow::Result<()> {\n    if timestamp_field_path.starts_with('.') || timestamp_field_path.starts_with(\"\\\\.\") {\n        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        };","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs#L100-L136","documentation":"The timestamp field drives time-based pruning and retention, so Quickwit requires it to hold exactly one value per document. If the mapped field's `Cardinality` is not `SingleValued` (e.g. an array field), `validate_timestamp_field` bails during DocMapper construction.","triggerScenarios":"Calling `DocMapperBuilder::try_from` with a `timestamp_field` that resolves to a field declared as an array/multi-valued datetime, e.g. `type: \"array<datetime>\"`.","commonSituations":"Users mapping log events that may contain several timestamps and declaring the field as an array, then referencing it as the index timestamp field; generic config generators defaulting to array types.","solutions":["Change the field type in the doc mapping from `array<datetime>` to `datetime` (single-valued).","Choose a different, single-valued datetime field as `timestamp_field`.","If multiple timestamps must be kept, index the extra ones as separate non-timestamp fields."],"exampleFix":"// before\ndoc_mapping:\n  field_mappings:\n    - name: ts\n      type: array<datetime>\n  timestamp_field: \"ts\"\n// after\ndoc_mapping:\n  field_mappings:\n    - name: ts\n      type: datetime\n  timestamp_field: \"ts\"","handlingStrategy":"validation","validationCode":"const f = findField(cfg.doc_mapping.field_mappings, cfg.doc_mapping.timestamp_field);\nif (f && /^array</.test(f.type)) throw new Error(`timestamp_field \"${f.name}\" must be single-valued, not ${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 single-valued\") => Err(ConfigError::InvalidTimestampField(e.to_string())),\n    Err(e) => Err(e.into()),\n}","preventionTips":["Always declare the timestamp field as a scalar `datetime`, never `array<datetime>`.","Keep extra timestamps as separate non-timestamp fields.","Document this constraint in your index-config templates."],"tags":["doc-mapping","timestamp","cardinality","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"}