quickwit-oss/tantivy · error

IP address support in dynamic fields is not yet implemented

Error message

IP address support in dynamic fields is not yet implemented

What it means

This panic is raised by record_json_value_to_columnar_writer when a JSON dynamic field value is an IpAddr leaf. Tantivy's columnar (fast field) writer does not yet support IP address values inside dynamic/JSON fields, so the code path is explicitly marked unimplemented. It is a library feature gap, not a user bug.

Source

Thrown at src/fastfield/writer.rs:346

                    NumericalValue::from(val),
                );
            }
            ReferenceValueLeaf::Bool(val) => {
                columnar_writer.record_bool(doc, json_path_writer.as_str(), val);
            }
            ReferenceValueLeaf::Date(val) => {
                columnar_writer.record_datetime(doc, json_path_writer.as_str(), val);
            }
            ReferenceValueLeaf::Facet(_) => {
                unimplemented!("Facet support in dynamic fields is not yet implemented")
            }
            ReferenceValueLeaf::Bytes(_) => {
                // TODO: This can be re added once it is added to the JSON Utils section as well.
                // columnar_writer.record_bytes(doc, json_path_writer.as_str(), val);
                unimplemented!("Bytes support in dynamic fields is not yet implemented")
            }
            ReferenceValueLeaf::IpAddr(_) => {
                unimplemented!("IP address support in dynamic fields is not yet implemented")
            }
            ReferenceValueLeaf::PreTokStr(_) => {
                unimplemented!(
                    "Pre-tokenized string support in dynamic fields is not yet implemented"
                )
            }
            ReferenceValueLeaf::Custom(_) => {
                unimplemented!("the JSON field does not support custom field types")
            }
        },
        ReferenceValue::Array(elements) => {
            for el in elements {
                record_json_value_to_columnar_writer(
                    doc,
                    el,
                    remaining_depth_limit,
                    json_path_writer,
                    columnar_writer,

View on GitHub (pinned to b5d8deb80c)

Solutions

  1. Move IP values out of JSON dynamic fields into a dedicated typed field with field type Ip (schema-level ip fast field).
  2. Store the IP as a string inside the JSON field if only display is needed (not as IpAddr leaf).
  3. Pre-process documents to strip or convert ip fields before indexing.
  4. Track upstream tantivy support for IpAddr in JSON dynamic fields and upgrade.

Example fix

// before
json_field_raw.add_json_object(doc, json!({"client_ip": "10.0.0.1"})); // IpAddr leaf -> panic
// after
let mut schema_builder = Schema::builder();
schema_builder.add_ip_field("client_ip", INDEXED | STORED | FAST);
let doc = Schema::builder().build().into();
// index client_ip via the dedicated ip field, not inside the JSON object
Defensive patterns

Strategy: validation

Validate before calling

fn json_has_ip_values(obj: &serde_json::Value) -> bool {
    match obj {
        serde_json::Value::String(s) => s.parse::<std::net::IpAddr>().is_ok(),
        serde_json::Value::Object(m) => m.values().any(json_has_ip_values),
        serde_json::Value::Array(a) => a.iter().any(json_has_ip_values),
        _ => false,
    }
}

Type guard

fn is_ip_leaf(v: &ReferenceValueLeaf) -> bool {
    matches!(v, ReferenceValueLeaf::IpAddr(_))
}

Prevention

When it happens

Trigger: Calling add_json_object / add_named_doc (or IndexWriter APIs that funnel into record_json_value_to_columnar_writer) with a JSON field whose value is an IpAddr ReferenceValue leaf, e.g. ip: "192.168.0.1" typed as IpAddr in a dynamic field.

Common situations: Indexing documents containing IP addresses as part of a JSON/dynamic field; migrating a schema from dedicated IP fields to catch-all JSON fields; JSON logs ingestion with ip attributes.

Related errors


AI-assisted analysis of quickwit-oss/tantivy@b5d8deb80c (2026-09-05). Data as JSON: /api/errors/97d3e6c32e707ad2. Report an issue: GitHub.