quickwit-oss/quickwit · error

range query without field is not supported

Error message

range query without field is not supported

What it means

In convert_user_input_ast_to_query_ast, a UserInputLeaf::Range that has no explicit field must have its field inferred from default_search_fields. With an empty default search field list there is nothing to infer from, so the conversion fails. Quickwit does not support field-less range queries when no default field is configured.

Solutions

  1. Prefix the range with a field name: `my_field:[a TO b]`.
  2. Configure/submit a default search field so unfielded queries have a target.
  3. Rewrite the query as an explicit range_query DSL node with a field.

Example fix

// before
let ast = parse_user_query("[2024-01-01 TO 2024-12-31]")?;
// after
let ast = parse_user_query("timestamp:[2024-01-01 TO 2024-12-31]")?;
Defensive patterns

Strategy: validation

Validate before calling

if !query_str.contains(':') && query_str.contains(" TO ") && default_search_fields.is_empty() {
    return Err("range query needs an explicit field or a default search field");
}

Try / catch

match parse_user_query(q) {
    Err(e) if e.to_string().contains("range query without field") => {
        // retry with an explicit field prefix
    }
    r => r?,
}

Prevention

When it happens

Trigger: Parsing a query string with an unfielded range like `timestamp:[2024-01-01 TO *]` (or `>=<value>` leaf without field) while default_search_fields is empty, via parse_user_query or nested conversion.

Common situations: Users typing Lucene-style range queries in the search bar of an index whose default search field is not set; APIs calling the user-input parser without passing default fields.

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/37105f639d3a3684. Report an issue: GitHub.

Appendix: source

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

            }
            Ok(bool_query.into())
        }
        UserInputAst::Leaf(leaf) => match *leaf {
            UserInputLeaf::Literal(literal) => {
                convert_user_input_literal(literal, default_search_fields, lenient)
            }
            UserInputLeaf::All => Ok(QueryAst::MatchAll),
            UserInputLeaf::Range {
                field,
                lower,
                upper,
            } => {
                let field = if let Some(field) = field {
                    field
                } else if default_search_fields.len() == 1 {
                    default_search_fields[0].clone()
                } else if default_search_fields.is_empty() {
                    bail!("range query without field is not supported");
                } else {
                    bail!("range query with multiple fields is not supported");
                };
                let convert_bound = |user_input_bound: UserInputBound| match user_input_bound {
                    UserInputBound::Inclusive(user_text) => {
                        Bound::Included(JsonLiteral::String(user_text))
                    }
                    UserInputBound::Exclusive(user_text) => {
                        Bound::Excluded(JsonLiteral::String(user_text))
                    }
                    UserInputBound::Unbounded => Bound::Unbounded,
                };
                let range_query = query_ast::RangeQuery {
                    field,
                    lower_bound: convert_bound(lower),
                    upper_bound: convert_bound(upper),
                };
                Ok(range_query.into())

View on GitHub (pinned to a39730c5cd)