Atlantiraptor Docs

index

Type: Plugin

Create a local index from a query.

This plugin uses Bleve to build an on-disk full text index of the query. The index can be searched with index_search().

In order to build the index, the fields must be analyzed. The analyzer breaks the text into tokens which are then indexed. The process depends on the nature of the data.

The mappings can dictate how this process is done:

  • text: This is the default analyzer - it considers the text to be English text and breaks it into words, applies suffixes etc.
  • number: The field is considered to be a number
  • date: The field is considered to be a date and parsed into a standard form.
  • bool: The field is considered a bool (true or false)
  • ip: The field is parsed as an IP.

If no field mappings are specified we treat all fields as text.

For example:

LET DataStream = SELECT OSPath, read_file(filename=OSPath) AS Data
FROM glob(globs="/etc/*")
WHERE NOT IsDir AND NOT IsLink

SELECT * FROM index(query=DataStream, output=IndexPath)

Once the index is created it can be searched. For example:

SELECT *
FROM index_search(path=IndexPath, fields="Data", search="syslog")
Argument Type Description
query StoredQuery (required) A VQL Query to parse and execute.
mapping ordereddict.Dict A dict to describe field mapping.
default_analyzer string The default analyzer to use.
output string (required) The file path to create the index on.
workers int64 Index with this many workers (default 2)
purge bool If set we delete the index to start fresh
batch int64 Default batch size for index (default 1000)
silent bool Do not forward events (this is faster)

Required permissions: FILESYSTEM_WRITE

Platforms: Linux, Windows

Source: vql/tools/index/index.go