Skip to content

block

Description

The block command filters out all documents where the given predicate evaluates to true. It is the inverse of filter, which keeps only documents that match the predicate.

Syntax

block <boolean expression>

Example

Use case: Exclude successful HTTP responses

In this example, we remove all documents representing successful (2xx) HTTP status codes to focus on redirects and errors.

Example data

{ "status_code": "200", "endpoint": "/api/login" },
{ "status_code": "301", "endpoint": "/api/redirect" },
{ "status_code": "500", "endpoint": "/api/payment" }

Example query

block $d.status_code.startsWith('2')

Example output

  { "status_code": "301", "endpoint": "/api/redirect" },
  { "status_code": "500", "endpoint": "/api/payment" }