{"record":{"id":"d26738252d013fdc","repo":"quickwit-oss/quickwit","slug":"record-tokenizer-and-fieldnorms-parameters","errorCode":null,"errorMessage":"`record`, `tokenizer`, and `fieldnorms` parameters are allowed only if indexed is true","messagePattern":"`record`, `tokenizer`, and `fieldnorms` parameters are allowed only if indexed is true","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-doc-mapper/src/doc_mapper/field_mapping_entry.rs","lineNumber":331,"sourceCode":"    pub fieldnorms: bool,\n}\n\nimpl TextIndexingOptions {\n    fn from_parts_text(\n        indexed: bool,\n        tokenizer: Option<QuickwitTextTokenizer>,\n        record: Option<IndexRecordOption>,\n        fieldnorms: bool,\n    ) -> anyhow::Result<Option<Self>> {\n        if indexed {\n            Ok(Some(TextIndexingOptions {\n                tokenizer: tokenizer.unwrap_or_default(),\n                record: record.unwrap_or(IndexRecordOption::Basic),\n                fieldnorms,\n            }))\n        } else {\n            if tokenizer.is_some() || record.is_some() || fieldnorms {\n                bail!(\n                    \"`record`, `tokenizer`, and `fieldnorms` parameters are allowed only if \\\n                     indexed is true\"\n                )\n            }\n            Ok(None)\n        }\n    }\n\n    fn from_parts_json(\n        indexed: bool,\n        tokenizer: Option<QuickwitTextTokenizer>,\n        record: Option<IndexRecordOption>,\n    ) -> anyhow::Result<Option<Self>> {\n        if indexed {\n            Ok(Some(TextIndexingOptions {\n                tokenizer: tokenizer.unwrap_or_else(QuickwitTextTokenizer::raw),\n                record: record.unwrap_or(IndexRecordOption::Basic),\n                fieldnorms: false,","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/field_mapping_entry.rs#L313-L349","documentation":"For text field mappings, indexing options `record` (frequency/position storage), `tokenizer`, and `fieldnorms` only make sense when the field is indexed. When building the text FieldMappingEntry with indexed=false, specifying any of these is contradictory and the builder rejects the mapping.","triggerScenarios":"Defining a field mapping JSON like `{type: \"text\", indexed: false, tokenizer: \"raw\"}` (or with `record`/`fieldnorms` set) — the from_parts_text constructor bails because indexing parameters accompany indexed:false.","commonSituations":"Users copying a text field mapping and just flipping `indexed: false` while leaving tokenizer/record options; storing-only text fields configured with search options; templates that always emit tokenizer settings.","solutions":["Remove `tokenizer`, `record`, and `fieldnorms` from the field mapping when `indexed: false`.","If you need those options, set `indexed: true` instead.","If the field is only meant for storage/fast retrieval, switch to appropriate options (e.g. keep indexed:false and only fast/stored flags)."],"exampleFix":"// before\n{name: \"notes\", type: \"text\", indexed: false, tokenizer: \"raw\"}\n// after\n{name: \"notes\", type: \"text\", indexed: false}","handlingStrategy":"validation","validationCode":"fn text_mapping_is_consistent(f: &serde_json::Value) -> bool {\n    if f.get(\"indexed\").and_then(|v| v.as_bool()) == Some(false) {\n        !(f.get(\"tokenizer\").is_some()\n            || f.get(\"record\").is_some()\n            || f.get(\"fieldnorms\").is_some())\n    } else { true }\n}","typeGuard":null,"tryCatchPattern":"match create_index_result {\n    Err(e) if e.to_string().contains(\"parameters are allowed only if indexed is true\") => {\n        eprintln!(\"Remove tokenizer/record/fieldnorms from fields with indexed:false\");\n    }\n    other => other?,\n}","preventionTips":["Strip indexing options whenever you toggle indexed to false in generated mappings.","Keep separate mapping templates for stored-only vs indexed text fields.","Add a JSON-schema/lint step on index configs before submission."],"tags":["schema","mapping","config","rust"],"backgroundTag":"conflicting-config-options","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"}