{"record":{"id":"1bfb6d52a512f23c","repo":"quickwit-oss/quickwit","slug":"tag-fields-are-required-to-be-indexed-is-no","errorCode":null,"errorMessage":"tag fields are required to be indexed. (`{}` is not configured as indexed)","messagePattern":"tag fields are required to be indexed\\. \\(`(.+?)` is not configured as indexed\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs","lineNumber":348,"sourceCode":"        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,\n) -> Result<(), anyhow::Error> {\n    for (_, field_entry) in schema.fields() {\n        let tokenizer_name_opt = match field_entry.field_type() {\n            FieldType::Str(options) => options\n                .get_indexing_options()\n                .map(|text_options: &tantivy::schema::TextFieldIndexing| text_options.tokenizer()),\n            FieldType::JsonObject(options) => options","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs#L330-L366","documentation":"Doc-mapper validation (`validate_tag`) found that the field nominated as a tag is not configured as indexed in the schema. Tag pruning relies on the field being part of the index (with the raw tokenizer for strings), so an unindexed field cannot serve as a tag and the mapping is rejected at build time.","triggerScenarios":"`QuickwitDocMapper::try_from` where a `tag_fields` entry passes the type/tokenizer checks but its field entry has `indexed: false` (e.g. fast-only numeric or stored-only text).","commonSituations":"Setting `indexed: false, fast: true` for aggregation on a numeric field while also listing it as a tag field, or disabling indexing on a field that was previously a tag.","solutions":["Enable indexing on the field (set `indexed: true` / appropriate index options).","Remove the field from `tag_fields` if it must remain non-indexed."],"exampleFix":"# before\n- name: tenant_id\n  type: u64\n  indexed: false\n  fast: true\ntag_fields: [tenant_id]\n\n# after\n- name: tenant_id\n  type: u64\n  indexed: true\n  fast: true\ntag_fields: [tenant_id]","handlingStrategy":"validation","validationCode":"fn check_tags_indexed(cfg: &serde_yaml::Value) -> Result<(), String> {\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            if tags.contains(&name)\n                && f.get(\"indexed\").and_then(|v| v.as_bool()) == Some(false) {\n                return Err(format!(\"tag field `{name}` must be indexed\"));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = QuickwitDocMapper::try_from(&index_config) {\n    if e.to_string().contains(\"required to be indexed\") {\n        eprintln!(\"Enable indexing on tag field: {e}\");\n    }\n    return Err(e);\n}","preventionTips":["Every tag field must have indexing enabled; never set `indexed: false` on a tag.","Fast-only fields cannot serve as tags — add indexing or drop the tag.","Cross-check tag_fields against field index options in CI config tests."],"tags":["config","tag-fields","indexing"],"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"}