Core Plugins and tasks FilterItems

Core Plugins and tasks FilterItems

Certified

Filter line-oriented files with a Pebble expression.

Reads a line-delimited file from internal storage, evaluates filterCondition per item, and writes matched lines to a new file. filterType controls include vs exclude; errorOrNullBehavior handles expression errors or nulls.

Expressions can reference columns directly (rendered as strings unless cast) and must return a boolean.

yaml
type: io.kestra.plugin.core.storage.FilterItems

Filter a CSV file and retain rows with a product ID equal to 20.

yaml
id: filter_items
namespace: company.team

tasks:
  - id: download
    type: io.kestra.plugin.core.http.Download
    uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

  - id: csv_to_ion
    type: io.kestra.plugin.serdes.csv.CsvToIon
    from: "{{ outputs.download.uri }}"

  - id: filter
    type: io.kestra.plugin.core.storage.FilterItems
    from: "{{ outputs.download.uri }}"
    filterCondition: "{{ (product_id | number) == 20 }}"
    filterType: INCLUDE
Properties

The expression used to match items to be included or excluded

Headers from the file can be referenced directly, e.g., {{ product_id }}, but will be rendered as a string unless combined with a filter, e.g., product_id | number. The Pebble expression should return a BOOLEAN value (i.e., true or false). Values 0, -0, and "" are interpreted as false. Otherwise, any non empty value will be interpreted as true.

The file to be filtered

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
DefaultFAIL
Possible Values
FAILINCLUDEEXCLUDE

Specifies the behavior when the expression fails to be evaluated on an item or returns null.

Use FAIL to throw the exception and fail the task, INCLUDE to pass the item through, or EXCLUDE to drop the item.

DefaultINCLUDE
Possible Values
INCLUDEEXCLUDE

Specifies the action to perform with items that match the filterCondition predicate

Use INCLUDE to pass the item through, or EXCLUDE to drop the items.

The total number of items that were dropped by the task

The total number of items that were processed by the task

Formaturi

The filtered file URI