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

tag fields are required to be indexed. (`{}` is not configur

Error message

tag fields are required to be indexed. (`{}` is not configured as indexed)

What it means

Doc-mapper validation (`validate_tag`) found that the field nominated as a tag is not configured as indexed in the schema. Tag pruning relies on the field being part of the index (with the raw tokenizer for strings), so an unindexed field cannot serve as a tag and the mapping is rejected at build time.

Source

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

        FieldType::U64(_) | FieldType::I64(_) => {
            // u64 and i64 are accepted as tags.
        }
        _ => {
            // We avoid the bytes / bool / f64 types,
            // as they are generally speaking poor tags and we want to avoid
            // bugs associated to the multiplicity of their representation.
            //
            // (Tags are relying heavily on string manipulation and we want to
            // avoid a "ZRP because you searched you searched for 0.100 instead of 0.1",
            // or `myflag:1`, `myflag:True` instead of `myflag:true`.
            bail!(
                "tags collection is not allowed on `{}` fields",
                field_type.value_type().name().to_lowercase()
            )
        }
    }
    if !field_type.is_indexed() {
        bail!(
            "tag fields are required to be indexed. (`{}` is not configured as indexed)",
            tag_field_name
        )
    }
    Ok(())
}

/// Checks that a given text/json field name has a registered tokenizer.
fn validate_fields_tokenizers(
    schema: &Schema,
    tokenizer_manager: &TokenizerManager,
) -> Result<(), anyhow::Error> {
    for (_, field_entry) in schema.fields() {
        let tokenizer_name_opt = match field_entry.field_type() {
            FieldType::Str(options) => options
                .get_indexing_options()
                .map(|text_options: &tantivy::schema::TextFieldIndexing| text_options.tokenizer()),
            FieldType::JsonObject(options) => options

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Enable indexing on the field (set `indexed: true` / appropriate index options).
  2. Remove the field from `tag_fields` if it must remain non-indexed.

Example fix

# before
- name: tenant_id
  type: u64
  indexed: false
  fast: true
tag_fields: [tenant_id]

# after
- name: tenant_id
  type: u64
  indexed: true
  fast: true
tag_fields: [tenant_id]
Defensive patterns

Strategy: validation

Validate before calling

fn check_tags_indexed(cfg: &serde_yaml::Value) -> Result<(), String> {
    let tags: Vec<&str> = cfg["doc_mapping"]["tag_fields"].as_sequence()
        .map(|s| s.iter().filter_map(|v| v.as_str()).collect()).unwrap_or_default();
    if let Some(fields) = cfg["doc_mapping"]["field_mappings"].as_sequence() {
        for f in fields {
            let name = f["name"].as_str().unwrap_or_default();
            if tags.contains(&name)
                && f.get("indexed").and_then(|v| v.as_bool()) == Some(false) {
                return Err(format!("tag field `{name}` must be indexed"));
            }
        }
    }
    Ok(())
}

Try / catch

if let Err(e) = QuickwitDocMapper::try_from(&index_config) {
    if e.to_string().contains("required to be indexed") {
        eprintln!("Enable indexing on tag field: {e}");
    }
    return Err(e);
}

Prevention

When it happens

Trigger: `QuickwitDocMapper::try_from` where a `tag_fields` entry passes the type/tokenizer checks but its field entry has `indexed: false` (e.g. fast-only numeric or stored-only text).

Common situations: Setting `indexed: false, fast: true` for aggregation on a numeric field while also listing it as a tag field, or disabling indexing on a field that was previously a tag.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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