Skip to main content

Lowercase

Mutate Elastic Compatible

Synopsis

Converts string values to lowercase.

Schema

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

Configuration

The following fields are used to define the processor:

FieldRequiredDefaultDescription
fieldY-Source field containing strings to convert
target_fieldNSame as fieldTarget field to store lowercase result
fieldsN-Array of fields to convert to lowercase
excludeN-Array of fields to exclude from conversion
descriptionN-Explanatory note
ifN-Condition to run
ignore_failureNfalseContinue processing if conversion fails
ignore_missingNfalseSkip processing if referenced field doesn't exist
on_failureN-See Handling Failures
on_successN-See Handling Success
tagN-Identifier

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"]
}

Keep Original

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"
}