{"record":{"id":"763f629b08913b71","repo":"quickwit-oss/quickwit","slug":"field-name-field-mapping-name-is-reserved-the","errorCode":null,"errorMessage":"field name `{field_mapping_name}` is reserved. the following fields are reserved for Quickwit internal usage: {}","messagePattern":"field name `(.+?)` is reserved\\. the following fields are reserved for Quickwit internal usage: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-doc-mapper/src/doc_mapper/field_mapping_entry.rs","lineNumber":878,"sourceCode":"/// Regular expression validating a field mapping name.\npub const FIELD_MAPPING_NAME_PATTERN: &str = r\"^[@$_\\-a-zA-Z][@$_/\\.\\-a-zA-Z0-9]{0,254}$\";\n\n/// Validates a field mapping name.\n/// Returns `Ok(())` if the name can be used for a field mapping.\n///\n/// A field mapping name:\n/// - can only contain uppercase and lowercase ASCII letters `[a-zA-Z]`, digits `[0-9]`, `.`,\n///   hyphens `-`, underscores `_`, at `@` and dollar `$` signs;\n/// - must not start with a dot or a digit;\n/// - must be different from Quickwit's reserved field mapping names `_source`, `_dynamic`,\n///   `_field_presence`;\n/// - must not be longer than 255 characters.\npub fn validate_field_mapping_name(field_mapping_name: &str) -> anyhow::Result<()> {\n    static FIELD_MAPPING_NAME_PTN: LazyLock<Regex> =\n        LazyLock::new(|| Regex::new(FIELD_MAPPING_NAME_PATTERN).unwrap());\n\n    if QW_RESERVED_FIELD_NAMES.contains(&field_mapping_name) {\n        bail!(\n            \"field name `{field_mapping_name}` is reserved. the following fields are reserved for \\\n             Quickwit internal usage: {}\",\n            QW_RESERVED_FIELD_NAMES.join(\", \"),\n        );\n    }\n    if FIELD_MAPPING_NAME_PTN.is_match(field_mapping_name) {\n        return Ok(());\n    }\n    if field_mapping_name.is_empty() {\n        bail!(\"field name is empty\");\n    }\n    if field_mapping_name.starts_with('.') {\n        bail!(\n            \"field name `{}` must not start with a dot `.`\",\n            field_mapping_name\n        );\n    }\n    if field_mapping_name.len() > 255 {","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/field_mapping_entry.rs#L860-L896","documentation":"Quickwit reserves certain field names (e.g. `_source`, `_id`, `_timestamp`, `_partition`, `_tag` — QW_RESERVED_FIELD_NAMES) for internal metadata. validate_field_mapping_name rejects any mapping field whose name matches one of them, listing the reserved names in the message.","triggerScenarios":"Creating an index or adding a field mapping named exactly one of the reserved identifiers, e.g. `{name: \"_source\", type: \"text\"}` — FieldMappingEntry::try_from calls validate_field_mapping_name and bails.","commonSituations":"Migrating Elasticsearch mappings where `_source`-style fields existed; users trying to store their own `_id`/`_timestamp` fields; programmatic mapping generation that echoes input document keys.","solutions":["Rename the field to a non-reserved name (e.g. `_id` -> `doc_id`).","If you need the document id/timestamp semantics, use Quickwit's native indexing options (`indexing_settings.timestamp_field`, node id or document `_id` handling) instead of a mapping field.","Sanitize generated mappings against QW_RESERVED_FIELD_NAMES before submitting."],"exampleFix":"// before\n{name: \"_timestamp\", type: \"datetime\", fast: true}\n// after\n{name: \"event_time\", type: \"datetime\", fast: true}\n// plus indexing_settings.timestamp_field = event_time","handlingStrategy":"validation","validationCode":"const RESERVED: &[&str] = &[\"_source\", \"_id\", \"_timestamp\", \"_partition\", \"_tag\"];\nfn field_name_allowed(name: &str) -> bool {\n    !RESERVED.contains(&name)\n}","typeGuard":null,"tryCatchPattern":"match create_index_result {\n    Err(e) if e.to_string().contains(\"is reserved\") => {\n        eprintln!(\"Rename the field; reserved names: _source, _id, _timestamp, _partition, _tag\");\n    }\n    other => other?,\n}","preventionTips":["Prefix user-defined metadata fields (e.g. `user_id` instead of `_id`).","Sanitize ES-style mappings before import, renaming reserved keys.","Keep the reserved-name list next to your mapping generator and check it on every emit."],"tags":["schema","mapping","validation","rust"],"backgroundTag":"invalid-identifier-format","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"}