Skip to main content

Package to parse Kibana Query Language (KQL) strings.

Project description

kibana-ql

Parser for the Kibana Query Language (KQL).

Install

pip install kibana-ql

Use

from kibana_ql import KqlParser
p = KqlParser()
tree = p.parse("field: value")
p.ast(tree)  # {'field': 'field', 'value': 'value'}
tree = p.parse('document: "tax" and @date > now-2w')
p.ast(tree)  # {'op': 'and', 'left': {'field': 'document', 'value': 'tax'}, 'right': {'field': '@date', 'op': '>', 'value': ('now-2w',)}}

Tests

py -m unittest discover -v -s tests -p "*_test.py"

Notes

Grammar file based on https://github.com/elastic/kibana/blob/main/packages/kbn-es-query/src/kuery/grammar/grammar.peggy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kibana_ql-0.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

kibana_ql-0.2-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page