quickwit-oss/quickwit · error

query requires a default search field and none was supplied

Error message

query requires a default search field and none was supplied

What it means

convert_user_input_literal turns an unfielded text literal into full-text queries over the default search fields. If the resulting field name list is empty (no explicit field, no defaults configured), the query cannot be evaluated anywhere, so it bails with this error. Quickwit requires every leaf-level text query to target at least one field.

Solutions

  1. Set `default_search_field` in the index config (e.g. to "body") so unfielded queries work.
  2. Prefix the query text with a field: `message:hello`.
  3. Pass a default search field explicitly when calling parse_user_query_with_default_fields.

Example fix

// before
parse_user_query("hello world")? // no defaults
// after
parse_user_query_with_default_fields("hello world", &["body"])
Defensive patterns

Strategy: validation

Validate before calling

if !query_str.contains(':') && default_search_fields.is_empty() {
    return Err("query has no field and no default search field is configured");
}

Try / catch

match parse_user_query(q) {
    Err(e) if e.to_string().contains("default search field") => {
        // retry with explicit defaults or field prefix
    }
    r => r?,
}

Prevention

When it happens

Trigger: Parsing a bare text query string like `parse_user_query("hello world")` while default_search_fields is empty; issuing REST searches without default_search_field configured on the index.

Common situations: Searches against indexes whose default_search_field was never set in the index config; query parsers invoked programmatically without default fields; typos in index configuration leaving the default field blank.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/e54b4bebc2923013. Report an issue: GitHub.

Appendix: source

Thrown at quickwit/quickwit-query/src/query_ast/user_input_query.rs:259

    lenient: bool,
) -> anyhow::Result<QueryAst> {
    let UserInputLiteral {
        field_name,
        phrase,
        prefix,
        delimiter,
        slop,
    } = user_input_literal;
    let field_names: Vec<String> = if let Some(field_name) = field_name {
        vec![field_name]
    } else {
        default_search_fields
            .iter()
            .map(|field_name| field_name.to_string())
            .collect()
    };
    if field_names.is_empty() {
        anyhow::bail!("query requires a default search field and none was supplied");
    }
    let mode = match delimiter {
        Delimiter::None => FullTextMode::PhraseFallbackToIntersection,
        Delimiter::SingleQuotes => FullTextMode::Bool {
            operator: BooleanOperand::And,
        },
        Delimiter::DoubleQuotes => FullTextMode::Phrase { slop },
    };
    let full_text_params = FullTextParams {
        tokenizer: None,
        mode,
        zero_terms_query: crate::MatchAllOrNone::MatchNone,
    };
    let wildcard = delimiter == Delimiter::None && is_wildcard(&phrase);
    let mut phrase_queries: Vec<QueryAst> = field_names
        .into_iter()
        .map(|field_name| {
            if prefix {

View on GitHub (pinned to a39730c5cd)