Skip to main content
Version: 3.2

lookup

Description

Allows retrieving data from a predefined lookup table. The command compares specified fields in the event and the lookup table. Upon a full match, the event will be enriched with the specified fields from the lookup table.

Syntax

lookup [dedup=<boolean>] [<execution-type>] [system=<boolean>] <lookup-name> ( <lookup-field> [AS <event-field>] )... [ OUTPUT | OUTPUTNEW (<lookup-destfield> [AS <event-destfield>] )... ]

Required Arguments

ParameterSyntaxDescription
lookup-name<lookup-name>The name of the predefined lookup.

Optional Arguments

ParameterSyntaxDefaultDescription
dedupdedup=<boolean>falseIndicates whether duplicates should be removed from the data compared to the lookup.
<execution-type>type=ELK [packsize=<integer>] | FASTDEFAULTSpecifies the execution type of the command. The ELK type indicates that the command is executed by Elasticsearch/OpenSearch, with a default packsize of 10,000. The FAST type represents an optimized, faster execution version of the command in DEFAULT mode.
systemsystem=<boolean>falseWhen set to true, a system lookup is performed; otherwise, a user lookup is used.
lookup-field<string>Several fields can be specified, separated by spaces.
event-field<string>The name of the field in the main result for comparison with the lookup-field. This is used when lookup-field and event-field have different names.
lookup-destfield<string>The name of the resulting field with obtained data.
OUTPUT | OUTPUTNEWOUTPUT | OUTPUTNEWOUTPUTThe OUTPUT indicator means that existing data in the source query field will be overwritten by the lookup data. The OUTPUTNEW indicator means that data will be overwritten only if the source query field is empty but has corresponding data in the lookup.
Command Configuration Recommendations
  1. Executing the command without specifying the execution type is recommended for small directory data volumes (up to 50 thousand events). It is also not recommended to execute commands with sme max_initial_query_len settings greater than 10,000 in this manner.
  2. Executing the command with the FAST type is not recommended for directories larger than 500 thousand events.
  3. For the ELK execution type, it is recommended not to set a large max_initial_query_len. The packsize parameter indicates how many events will be processed per request by the engine in each iteration. That is, if max_initial_query_len = 10,000 and packsize = 5,000, then during one iteration of 10 thousand events, two requests (max_initial_query_len/packsize) will be sent to Elastic. If max_initial_query_len exceeds 20 thousand, it is recommended to execute the command with a packsize parameter two or three times smaller than max_initial_query_len.

Query Examples

Example №1
source tables
| search database = "hr"
| lookup my_click_db name as database OUTPUT engine
Example №2
source tables
| search database = "hr"
| lookup type=SOURCE packsize=5000 my_click_db name as database OUTPUTNEW engine