Skip to main content

PPL overview

LynxDB queries are written in OpenSearch Piped Processing Language (PPL). A query is a pipeline: a source command reads events, and each command after a | transforms the rows the previous command produced.

source=main status>=500 earliest=-1h
| stats count() as errors, p95(response_time) as p95 by host
| sort - errors
| head 5

The same text runs everywhere a query is accepted:

Entry pointWhat runs the query
lynxdb query '<query>'the server, over REST
lynxdb query --file app.log '<query>', cat app.log | lynxdb query '<query>'the CLI process, over the input loaded into the index main
POST /api/v1/query, /api/v1/query/streamthe server
lynxdb explain '<query>', GET /api/v1/query/explainthe server's compiler, without running the query

Every entry point compiles the text with the same compiler (pkg/query) into the same plan, so a query that works on a file works on the server.

How LynxDB relates to OpenSearch PPL​

The PPL pages keep three things apart:

  1. OpenSearch PPL semantics. Syntax, commands, functions and their documented behavior follow the OpenSearch PPL reference. Where LynxDB implements a feature fully, the OpenSearch documentation applies.
  2. LynxDB execution behavior. LynxDB stores schema-on-read log events, not OpenSearch documents. Free-text search matches the tokens of every string field of an event, every index is local, and there are no relevance scores. Where this changes a result, the pages say so under a LynxDB behavior heading.
  3. OpenSearch features LynxDB does not support. Unsupported commands, functions and options fail at compile time with an UNSUPPORTED_COMMAND, UNSUPPORTED_FUNCTION or UNSUPPORTED_FEATURE error. Nothing unsupported is silently approximated. The feature matrix lists them.

Where to go next​

TopicPage
First queriesGetting started
Pipelines, identifiers, literals, precedence, commentsSyntax
The grammar as implementedGrammar
Types and conversionsData types
Operators, NULL handling, conditionsExpressions
Free-text and field searchSearch semantics
The main commandsCommand guide, command support table
Scalar functionsFunction guide, function table
AggregationsAggregation guide, aggregation table
Time seriesTime series
Joins, lookups, subsearchesJoins and subsearches
What is and is not supportedFeature matrix
Error codes and positionsError handling
Worked queriesExamples
How a plan runs; making queries fastPipeline execution, Performance
Compiler internalsArchitecture, PPL-to-IR compilation, IR specification, IR optimizer
Extending the languageAdding commands, Adding functions

The command, function and aggregation tables are generated from the catalogs in pkg/ppl by go run ./internal/docgen. GET /api/v1/catalog returns the same catalogs as JSON.