Skip to main content

Lowercase

Mutate Elastic Compatible

Synopsis

Converts string values to lowercase.

Schema

lowercase:
- field: <ident>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
- target_field: <ident>

Configuration

FieldRequiredDefaultDescription
fieldY-Source field containing strings to convert
descriptionN-Documentation note
ifN-Conditional expression
ignore_failureNfalseSkip processing errors
ignore_missingNfalseSkip if input field missing
on_failureN-Error handling processors
on_successN-Success handling processors
tagN-Identifier for logging
target_fieldNfieldOutput field for converted strings

Details

The processor can handle both single strings and arrays of strings, applying the transformation to all elements.

The processor is useful for standardizing text fields and tags or categories, prepare fields such as emails addresses for case-insensitive comparisons

note

The processor maintains the original field structure: single strings remain single strings, and arrays remain arrays.

warning

Non-string values in the input field will cause processing errors unless ignore_failure is set to true.

Examples

Basic

Converting a single string...

{
"username": "JohnDoe"
}
lowercase:
- field: username

transforms the element:

{
"username": "johndoe"
}

Arrays

Converting an array of strings...

{
"tags": ["User", "Admin", "MANAGER"]
}
lowercase:
- field: tags

transforms all elements:

{
"tags": ["user", "admin", "manager"]
}

Target Field

Storing the result in a new field...

{
"original": "HELLO WORLD"
}
lowercase:
- field: original
- target_field: lowercase_text

preserves the original:

{
"original": "HELLO WORLD",
"lowercase_text": "hello world"
}

Conditionals

Using selection criteria...

{
"level": "DEBUG",
"should_convert": true
}
lowercase:
- field: level
- if: "ctx.should_convert == true"

converts only values that meet the condition:

{
"level": "debug",
"should_convert": true
}

Error Handling

Handling non-string values gracefully...

{
"id": 12345,
"name": "USER"
}
lowercase:
- field: id
- ignore_failure: true
- on_failure:
- set:
- field: error
- value: "Non-string field encountered"

continues the execution:

{
"id": 12345,
"name": "USER",
"error": "Non-string field encountered"
}