Enrich
Synopsis
Enriches documents by performing SQL queries against lookup tables loaded from CSV files or datasets. It can then join the data with externally referenced information to add context and semantic depth.
Schema
enrich:
- lookup_table: <string[]>
- dataset_name: <string[]>
- query: <string>
- type: <string>
- description: <text>
- if: <script>
- tag: <string>
- on_success: <processor[]>
- on_failure: <processor[]>
- override: <boolean>
- ignore_missing: <boolean>
- ignore_failure: <boolean>
Configuration
Field | Required | Default | Description |
---|---|---|---|
lookup_table | N | - | Array of paths to CSV files containing lookup data |
dataset_name | N | - | Array of dataset names to load lookup data from |
query | Y | - | SQL or KQL query to execute for enrichment |
type | N | - | Query language type (kusto for KQL, empty for SQLite) |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if enrichment fails |
ignore_missing | N | false | Skip if fields don't exist |
on_failure | N | - | Processors to run on failure |
on_success | N | - | Processors to run on success |
override | N | false | If true, replaces existing document with query results |
tag | N | - | Identifier for logging |
Details
Information gathering from external sources involves
- loading lookup data from CSV files or datasets which may involve using SQL queries, including SQLite and Kusto Query Language (KQL),
- extracting and manipulating JSON data, overriding fields, and
- resolving conflicts.
KQL queries are automatically converted to SQLite syntax, and some complex KQL features might not be supported.
The processor provides the following special tables and fields for queries:
_ingest | Contains the current document's data |
_message | JSON string of the entire document |
lookup_table | Contains data loaded from CSV files |
CSV files must have headers in the first row as the column names become field names in queries. Headers are case-sensitive, and empty values are treated as NULL.
As large CSV files are loaded directly into memory, the impact of using very large lookup tables must be carefully considered.
Examples
CSV Lookup
Enriching logs with data from a CSV table... |
|
adds description: |
|
KQL Queries
Processing logs using Kusto Query Language... |
|
adds computed fields: |
|
Multiple Tables
Joining data from multiple lookup tables... |
|
combines information from both tables: |
|
Override Mode
Replacing the document with query results... |
|
keeps only the selected fields: |
|