{"record":{"id":"f541cf7bb98f4fdb","repo":"quickwit-oss/quickwit","slug":"tags-collection-is-not-allowed-on-fields","errorCode":null,"errorMessage":"tags collection is not allowed on `{}` fields","messagePattern":"tags collection is not allowed on `(.+?)` fields","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs","lineNumber":341,"sourceCode":"            let tokenizer_opt = options\n                .get_indexing_options()\n                .map(|text_options: &tantivy::schema::TextFieldIndexing| text_options.tokenizer());\n            if tokenizer_opt != Some(RAW_TOKENIZER_NAME) {\n                bail!(\"tags collection is only allowed on text fields with the `raw` tokenizer\");\n            }\n        }\n        FieldType::U64(_) | FieldType::I64(_) => {\n            // u64 and i64 are accepted as tags.\n        }\n        _ => {\n            // We avoid the bytes / bool / f64 types,\n            // as they are generally speaking poor tags and we want to avoid\n            // bugs associated to the multiplicity of their representation.\n            //\n            // (Tags are relying heavily on string manipulation and we want to\n            // avoid a \"ZRP because you searched you searched for 0.100 instead of 0.1\",\n            // or `myflag:1`, `myflag:True` instead of `myflag:true`.\n            bail!(\n                \"tags collection is not allowed on `{}` fields\",\n                field_type.value_type().name().to_lowercase()\n            )\n        }\n    }\n    if !field_type.is_indexed() {\n        bail!(\n            \"tag fields are required to be indexed. (`{}` is not configured as indexed)\",\n            tag_field_name\n        )\n    }\n    Ok(())\n}\n\n/// Checks that a given text/json field name has a registered tokenizer.\nfn validate_fields_tokenizers(\n    schema: &Schema,\n    tokenizer_manager: &TokenizerManager,","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs#L323-L359","documentation":"Tags are only permitted on Str (with raw tokenizer), U64, and I64 fields. Other field types (bool, f64, date, bytes, json, arrays) are rejected because their multiple textual representations would cause zero-result-page bugs in tag-based filtering.","triggerScenarios":"`QuickwitDocMapper::try_from` where a `tag_fields` entry resolves to a field whose type is not Str/U64/I64 — e.g. bool, f64, date, bytes, or json.","commonSituations":"Marking a boolean flag or a timestamp/date field as a tag and hitting the representation-multiplicity restriction (e.g. `true` vs `True`, `0.1` vs `0.100`).","solutions":["Change the field type to u64/i64 or a raw-tokenized text field if tag semantics are needed.","Remove the field from `tag_fields` and filter with a regular query instead.","For booleans, model the flag as a `raw` text or u64 field to make it taggable."],"exampleFix":"# before\n- name: is_error\n  type: bool\ntag_fields: [is_error]\n\n# after\n- name: is_error\n  type: u64\n  fast: true\ntag_fields: [is_error]","handlingStrategy":"validation","validationCode":"fn check_tag_field_types(cfg: &serde_yaml::Value) -> Result<(), String> {\n    let allowed = [\"text\", \"u64\", \"i64\", \"integer\", \"uint64\", \"int64\"];\n    let tags: Vec<&str> = cfg[\"doc_mapping\"][\"tag_fields\"].as_sequence()\n        .map(|s| s.iter().filter_map(|v| v.as_str()).collect()).unwrap_or_default();\n    if let Some(fields) = cfg[\"doc_mapping\"][\"field_mappings\"].as_sequence() {\n        for f in fields {\n            let name = f[\"name\"].as_str().unwrap_or_default();\n            let ty = f[\"type\"].as_str().unwrap_or_default();\n            if tags.contains(&name) && !allowed.contains(&ty) {\n                return Err(format!(\"tags not allowed on `{}` fields: {name}\", ty));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = QuickwitDocMapper::try_from(&index_config) {\n    if e.to_string().starts_with(\"tags collection is not allowed\") {\n        eprintln!(\"Change field type or remove from tag_fields: {e}\");\n    }\n    return Err(e);\n}","preventionTips":["Restrict tag_fields to text (raw), u64, and i64 fields.","Don't tag bool/f64/date/bytes/json fields — filter them with queries instead.","Booleans as tags: store as u64 0/1 with `indexed: true`."],"tags":["config","tag-fields","field-types"],"backgroundTag":"unsupported-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"}