Skip to content

allow slash / in field name #4510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/configuration/index-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,11 @@ src.port:53 AND query_params.ctk:e42bb897d
### Field name validation rules

Currently Quickwit only accepts field name that matches the following regular expression:
`^[@$_\-a-zA-Z][@$_\.\-a-zA-Z0-9]{0,254}$`
`^[@$_\-a-zA-Z][@$_/\.\-a-zA-Z0-9]{0,254}$`

In plain language:
- it needs to have at least one character.
- it can only contain uppercase and lowercase ASCII letters `[a-zA-Z]`, digits `[0-9]`, `.`, hyphens `-`, underscores `_`, at `@` and dollar `$` signs.
- it can only contain uppercase and lowercase ASCII letters `[a-zA-Z]`, digits `[0-9]`, `.`, hyphens `-`, underscores `_`, slash `/`, at `@` and dollar `$` signs.
- it must not start with a dot or a digit.
- it must be different from Quickwit's reserved field mapping names `_source`, `_dynamic`, `_field_presence`.

Expand Down
3 changes: 2 additions & 1 deletion quickwit/quickwit-doc-mapper/src/default_doc_mapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub(crate) use self::tokenizer_entry::{
use crate::QW_RESERVED_FIELD_NAMES;

/// Regular expression validating a field mapping name.
pub const FIELD_MAPPING_NAME_PATTERN: &str = r"^[@$_\-a-zA-Z][@$_\.\-a-zA-Z0-9]{0,254}$";
pub const FIELD_MAPPING_NAME_PATTERN: &str = r"^[@$_\-a-zA-Z][@$_/\.\-a-zA-Z0-9]{0,254}$";

/// Validates a field mapping name.
/// Returns `Ok(())` if the name can be used for a field mapping.
Expand Down Expand Up @@ -149,6 +149,7 @@ mod tests {
assert!(validate_field_mapping_name("my.field").is_ok());
assert!(validate_field_mapping_name("my_field").is_ok());
assert!(validate_field_mapping_name("$my_field@").is_ok());
assert!(validate_field_mapping_name("my/field").is_ok());
assert!(validate_field_mapping_name(&"a".repeat(255)).is_ok());
}
}