quickwit-oss/quickwit · error

not yet implemented

Error message

not yet implemented

What it means

build_tantivy_ast_impl for RangeQuery hits a `todo!()` when the target field is of tantivy FieldType::Bytes: converting a range query over a bytes fast-field into a tantivy AST is simply not implemented yet. The panic message is Rust's default "not yet implemented".

Source

Thrown at quickwit/quickwit-query/src/query_ast/range_query.rs:204

                FastFieldRangeQuery::new(
                    lower_bound.map(|val| Term::from_field_date(field, val)),
                    upper_bound.map(|val| Term::from_field_date(field, val)),
                )
                .into()
            }
            tantivy::schema::FieldType::Facet(_) => {
                return Err(InvalidQuery::RangeQueryNotSupportedForField {
                    value_type: "facet",
                    field_name: field_entry.name().to_string(),
                });
            }
            tantivy::schema::FieldType::Custom(_) => {
                return Err(InvalidQuery::RangeQueryNotSupportedForField {
                    value_type: "custom",
                    field_name: field_entry.name().to_string(),
                });
            }
            tantivy::schema::FieldType::Bytes(_) => todo!(),
            tantivy::schema::FieldType::JsonObject(options) => {
                let mut sub_queries: Vec<TantivyQueryAst> = Vec::new();
                let empty_term =
                    Term::from_field_json_path(field, json_path, options.is_expand_dots_enabled());
                // Try to convert the bounds into numerical values in following order i64, u64,
                // f64. Tantivy will convert to the correct numerical type of the column if it
                // doesn't match.
                let bounds_range_i64: Option<(Bound<i64>, Bound<i64>)> =
                    convert_bound(&self.lower_bound).zip(convert_bound(&self.upper_bound));
                let bounds_range_u64: Option<(Bound<u64>, Bound<u64>)> =
                    convert_bound(&self.lower_bound).zip(convert_bound(&self.upper_bound));
                let bounds_range_f64: Option<(Bound<f64>, Bound<f64>)> =
                    convert_bound(&self.lower_bound).zip(convert_bound(&self.upper_bound));
                if let Some(range) = bounds_range_i64 {
                    sub_queries.push(query_from_fast_val_range(&empty_term, range).into());
                } else if let Some(range) = bounds_range_u64 {
                    sub_queries.push(query_from_fast_val_range(&empty_term, range).into());
                } else if let Some(range) = bounds_range_f64 {

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Do not issue range queries on bytes fields — filter on a numeric, date, or ip field instead.
  2. Validate the query against the field's type at parse time and return InvalidQuery (like the Custom branch) rather than reaching the todo!().
  3. Wait for/implement bytes range support upstream in the quickwit-query crate.

Example fix

// before
tantivy::schema::FieldType::Bytes(_) => todo!(),
// after
tantivy::schema::FieldType::Bytes(_) => {
    return Err(InvalidQuery::RangeQueryNotSupportedForField {
        value_type: "bytes",
        field_name: field_entry.name().to_string(),
    });
}
Defensive patterns

Strategy: validation

Validate before calling

if field_type == "bytes" && query_has_range_predicate {
    return Err("range queries are not supported on bytes fields".into());
}

Type guard

fn is_bytes_field(schema: &Schema, field: &str) -> bool {
    schema.get_field(field)
        .and_then(|f| schema.get_field_entry(f).field_type().try_into().ok())
        .map(|t| t.is_bytes())
        .unwrap_or(false)
}

Try / catch

// replace todo! with typed error so callers can catch:
match build_tantivy_ast(range_query) {
    Err(InvalidQuery::RangeQueryNotSupportedForField { .. }) => /* 400 to client */,
    Err(e) => return Err(e),
    Ok(ast) => ast,
}

Prevention

When it happens

Trigger: Executing a range query (`range: {field: {gte/gt/lt/lte: ...}}`) against a field mapped as `bytes` in the index config.

Common situations: Users assuming byte fields support range filtering like numeric fields; queries generated by dashboards or ES-compat clients over binary columns.

Related errors


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