{"record":{"id":"703bdc8b71b1422f","repo":"quickwit-oss/quickwit","slug":"record-and-tokenizer-parameters-are-allowed-on","errorCode":null,"errorMessage":"`record` and `tokenizer` parameters are allowed only if indexed is true","messagePattern":"`record` and `tokenizer` 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":353,"sourceCode":"            }\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,\n            }))\n        } else {\n            if tokenizer.is_some() || record.is_some() {\n                bail!(\"`record` and `tokenizer` parameters are allowed only if indexed is true\")\n            }\n            Ok(None)\n        }\n    }\n\n    fn from_parts_concatenate(\n        tokenizer: Option<QuickwitTextTokenizer>,\n        record: Option<IndexRecordOption>,\n    ) -> anyhow::Result<Self> {\n        let text_index_options_opt = Self::from_parts_text(true, tokenizer, record, false)?;\n        let text_index_options = text_index_options_opt.expect(\"concatenate field must be indexed\");\n        Ok(text_index_options)\n    }\n\n    fn to_parts_text(\n        this: Option<Self>,\n    ) -> (\n        bool, // indexed","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/field_mapping_entry.rs#L335-L371","documentation":"Same rule as error 83 but for JSON-type field mappings: when indexed=false, a JSON field may not carry `record` or `tokenizer` options. The from_parts_json constructor treats their presence as contradictory and rejects the mapping.","triggerScenarios":"A field mapping like `{type: \"json\", indexed: false, tokenizer: \"raw\"}` or with `record: basic` — from_parts_json bails since search options require an indexed field.","commonSituations":"Copy-pasting tokenizer options from a text mapping onto a json field that was toggled to indexed:false; generated mappings that always include default record/tokenizer values; users trying to control tokenization of unindexed json fields.","solutions":["Remove `record` and `tokenizer` from the json field mapping when `indexed: false`.","Set `indexed: true` if tokenization/record options are required.","Review mapping templates to drop indexing options for unindexed fields."],"exampleFix":"// before\n{name: \"attrs\", type: \"json\", indexed: false, tokenizer: \"raw\", record: \"basic\"}\n// after\n{name: \"attrs\", type: \"json\", indexed: false}","handlingStrategy":"validation","validationCode":"fn json_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() || f.get(\"record\").is_some())\n    } else { true }\n}","typeGuard":null,"tryCatchPattern":"match create_index_result {\n    Err(e) if e.to_string().contains(\"`record` and `tokenizer` parameters are allowed only if indexed is true\") => {\n        eprintln!(\"Drop record/tokenizer from unindexed json fields\");\n    }\n    other => other?,\n}","preventionTips":["Never copy text-field tokenizer options onto json fields.","Validate mappings with the same lint rules for text and json types.","Let defaults apply: indexed json fields already get tokenizer/record defaults."],"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"}