quickwit-oss/quickwit · error · anyhow::Error

could not find timestamp field `{timestamp_field_path}` in f

Error message

could not find timestamp field `{timestamp_field_path}` in field mappings

What it means

After format checks, `validate_timestamp_field` looks up `timestamp_field` in the mapping tree via `find_field_mapping_type`. If no field matches the path, the DocMapper builder bails: a timestamp field must point at an existing mapped field.

Source

Thrown at quickwit/quickwit-doc-mapper/src/doc_mapper/doc_mapper_impl.rs:114

    tokenizer_entries: Vec<TokenizerEntry>,
    /// Tokenizer manager.
    tokenizer_manager: TokenizerManager,
}

fn validate_timestamp_field(
    timestamp_field_path: &str,
    mapping_root_node: &MappingNode,
) -> anyhow::Result<()> {
    if timestamp_field_path.starts_with('.') || timestamp_field_path.starts_with("\\.") {
        bail!("timestamp field `{timestamp_field_path}` should not start with a `.`");
    }
    if timestamp_field_path.ends_with('.') {
        bail!("timestamp field `{timestamp_field_path}` should not end with a `.`");
    }
    let Some(timestamp_field_type) =
        mapping_root_node.find_field_mapping_type(timestamp_field_path)
    else {
        bail!("could not find timestamp field `{timestamp_field_path}` in field mappings");
    };
    if let FieldMappingType::DateTime(date_time_option, cardinality) = &timestamp_field_type {
        if cardinality != &Cardinality::SingleValued {
            bail!("timestamp field `{timestamp_field_path}` should be single-valued");
        }
        if !date_time_option.fast {
            bail!("timestamp field `{timestamp_field_path}` should be a fast field");
        }
    } else {
        bail!("timestamp field `{timestamp_field_path}` should be a datetime field");
    }
    Ok(())
}

impl From<DocMapper> for DocMapperBuilder {
    fn from(default_doc_mapper: DocMapper) -> Self {
        let partition_key_str = default_doc_mapper.partition_key.to_string();
        let partition_key_opt: Option<String> = if !partition_key_str.is_empty() {

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Make `timestamp_field` exactly match an existing field path in `doc_mapping.field_mappings` (check spelling and nesting, e.g. `event.time`).
  2. Add the field to the mapping if it is genuinely missing.
  3. Remove or update `timestamp_field` when the underlying field was deleted.

Example fix

// before
doc_mapping:
  field_mappings:
    - name: ts
      type: datetime
  timestamp_field: "timestamp"
// after
doc_mapping:
  field_mappings:
    - name: ts
      type: datetime
  timestamp_field: "ts"
Defensive patterns

Strategy: validation

Validate before calling

function fieldExists(mapping, path) {
  const parts = path.split('.');
  let node = mapping.field_mappings;
  for (const p of parts) {
    const hit = (Array.isArray(node) ? node : []).find(f => f.name === p);
    if (!hit) return false;
    node = hit.field_mappings ?? [];
  }
  return true;
}
// before applying config: if (!fieldExists(cfg.doc_mapping, cfg.doc_mapping.timestamp_field)) throw ...

Try / catch

match DocMapperBuilder::try_from(config) {
    Ok(dm) => Ok(dm),
    Err(e) if e.to_string().contains("could not find timestamp field") => Err(ConfigError::UnknownTimestampField(e.to_string())),
    Err(e) => Err(e.into()),
}

Prevention

When it happens

Trigger: Calling `DocMapperBuilder::try_from` where `doc_mapping.timestamp_field` names a path absent from `field_mappings` — misspelled name, wrong nesting level, or the field was removed from the mapping while still referenced as timestamp field.

Common situations: Renaming or deleting a field in the doc mapping but forgetting to update `timestamp_field`; typos; pointing at a dynamic/virtual field that is not declared in field_mappings; changing object nesting so the dotted path no longer resolves.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — 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/548dcf669429014d. Report an issue: GitHub.