{"record":{"id":"8d247aec5ab612dc","repo":"quickwit-oss/quickwit","slug":"regex-query-without-field-is-not-supported","errorCode":null,"errorMessage":"regex query without field is not supported","messagePattern":"regex query without field is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-query/src/query_ast/user_input_query.rs","lineNumber":182,"sourceCode":"                if field_names.is_empty() {\n                    anyhow::bail!(\"set query need to target a specific field\");\n                }\n                let mut terms_per_field: HashMap<String, BTreeSet<String>> = Default::default();\n                let terms: BTreeSet<String> = elements.into_iter().collect();\n                for field in field_names {\n                    terms_per_field.insert(field.to_string(), terms.clone());\n                }\n                let term_set_query = query_ast::TermSetQuery { terms_per_field };\n                Ok(term_set_query.into())\n            }\n            UserInputLeaf::Exists { field } => Ok(FieldPresenceQuery { field }.into()),\n            UserInputLeaf::Regex { field, pattern } => {\n                let field = if let Some(field) = field {\n                    field\n                } else if default_search_fields.len() == 1 {\n                    default_search_fields[0].clone()\n                } else if default_search_fields.is_empty() {\n                    bail!(\"regex query without field is not supported\");\n                } else {\n                    bail!(\"regex query with multiple fields is not supported\");\n                };\n                let regex_query = query_ast::RegexQuery {\n                    field,\n                    regex: pattern,\n                };\n                Ok(regex_query.into())\n            }\n        },\n        UserInputAst::Boost(underlying, boost) => {\n            let query_ast = convert_user_input_ast_to_query_ast(\n                *underlying,\n                default_occur,\n                default_search_fields,\n                lenient,\n            )?;\n            let boost: NotNaNf32 = (boost.into_inner() as f32)","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-query/src/query_ast/user_input_query.rs#L164-L200","documentation":"For UserInputLeaf::Regex, the field must come from the leaf itself or be uniquely inferable from default_search_fields. With no field on the leaf and an empty default search field list, there is no target for the regex match, so the conversion bails with this error.","triggerScenarios":"Parsing an unfielded regex query string like `/foo.*bar/` (no `field:` prefix) while no default search field is configured, via parse_user_query or nested conversion.","commonSituations":"Users pasting Lucene regex queries into a search box on indexes without a default field; programmatic query parsing that omits default_search_fields.","solutions":["Add an explicit field prefix: `message:/foo.*bar/`.","Configure a default search field for the search request or index.","Build a query_ast::RegexQuery directly with the field set."],"exampleFix":"// before\nparse_user_query(\"/err.*timeout/\")?\n// after\nparse_user_query(\"message:/err.*timeout/\")?","handlingStrategy":"validation","validationCode":"if looks_like_regex(query_str) && !query_str.contains(':') && default_search_fields.is_empty() {\n    return Err(\"regex query needs an explicit field or a default search field\");\n}","typeGuard":null,"tryCatchPattern":"match parse_user_query(q) {\n    Err(e) if e.to_string().contains(\"regex query without field\") => {\n        // retry with field-qualified regex\n    }\n    r => r?,\n}","preventionTips":["Prefix regex queries with the target field.","Configure default_search_field for indexes exposed to free-text search.","Document that unfielded regex/range/set shorthand requires a single default field."],"tags":["regex-query","user-input","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}