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
index_json_value panics via unimplemented!() when a dynamically-typed JSON leaf is an IpAddr. IP address values cannot be indexed within dynamic JSON fields yet; they require a schema-typed ip field. The panic is intentional.
Source
Thrown at src/core/json_utils.rs:228
.get_or_allocate_unordered_id(json_path_writer.as_str()),
);
let val = val.truncate(DATE_TIME_PRECISION_INDEXED);
term_buffer.append_type_and_fast_value(val);
postings_writer.subscribe(doc, 0u32, term_buffer, ctx);
}
ReferenceValueLeaf::PreTokStr(_) => {
unimplemented!(
"Pre-tokenized string support in dynamic fields is not yet implemented"
)
}
ReferenceValueLeaf::Bytes(_) => {
unimplemented!("Bytes support in dynamic fields is not yet implemented")
}
ReferenceValueLeaf::Facet(_) => {
unimplemented!("Facet support in dynamic fields is not yet implemented")
}
ReferenceValueLeaf::IpAddr(_) => {
unimplemented!("IP address support in dynamic fields is not yet implemented")
}
ReferenceValueLeaf::Custom(_) => {
unimplemented!("the JSON field does not support custom field types")
}
},
ReferenceValue::Array(elements) => {
for val in elements {
index_json_value(
doc,
val,
text_analyzer,
term_buffer,
json_path_writer,
postings_writer,
ctx,
positions_per_path,
);
}View on GitHub (pinned to b5d8deb80c)
Solutions
- Declare an ip field in the schema (IpAddr options) and index the value there
- Store the IP as its string representation (e.g. "192.168.0.1") in the JSON field
- Remove the typed IP value from JSON documents before indexing
Example fix
// before
json_obj.insert("client_ip", Value::IpAddr(ip));
// after
json_obj.insert("client_ip", Value::Str(ip.to_string())); Defensive patterns
Strategy: validation
Validate before calling
fn json_has_typed_ip(v: &serde_json::Value) -> bool {
// typed IpAddr leaves only come from tantivy values; string IPs are fine
match v {
serde_json::Value::Array(a) => a.iter().any(json_has_typed_ip),
serde_json::Value::Object(o) => o.values().any(json_has_typed_ip),
_ => false,
}
} Type guard
fn is_ip_leaf(v: &tantivy::schema::Value) -> bool {
matches!(v.as_value(), tantivy::schema::ReferenceValueLeaf::IpAddr(_))
} Try / catch
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| index_writer.add_document(doc)));
if result.is_err() { eprintln!("dynamic JSON field contained typed IpAddr"); } Prevention
- Store IPs as strings in JSON fields (e.g. "10.0.0.1")
- Use schema-typed ip fields when IP fast-field/range queries are needed
- Sanitize values before add_document
- Review typed-value usage when refactoring to dynamic JSON fields
When it happens
Trigger: Indexing a document whose JSON field value is a tantivy IpAddr leaf via index_document.
Common situations: Putting IP-address typed values into JSON objects instead of strings; migrating typed ip fields into dynamic JSON fields.
Related errors
- Pre-tokenized string support in dynamic fields is not yet im
- Bytes support in dynamic fields is not yet implemented
- Facet support in dynamic fields is not yet implemented
- the JSON field does not support custom field types
- IP address support in dynamic fields is not yet implemented
AI-assisted analysis of quickwit-oss/tantivy@b5d8deb80c (2026-09-05).
Data as JSON: /api/errors/09fc175a8e6e07af.
Report an issue: GitHub.