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
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file kibana_ql-0.2.tar.gz
.
File metadata
- Download URL: kibana_ql-0.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7f4ddf548aa1cf7086713edf157f435214a5be9f6ee992ff88000787f2c1fd7 |
|
MD5 | b2c333f21f852fc18d5afbeb9518e601 |
|
BLAKE2b-256 | 339731332631ddd3f8c28d906c93c2247b5f54b87c15d30d490ec5ecf177c74a |
File details
Details for the file kibana_ql-0.2-py3-none-any.whl
.
File metadata
- Download URL: kibana_ql-0.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a6a476465219ceb8a37b7d472cd86593f2241a298e9a46f32a315ce0ab919c4 |
|
MD5 | 78580e14a70d520c4059ea504aea8eb5 |
|
BLAKE2b-256 | d4bcf9a0152ca515db3384dc565b09721591646200e3677acaed9b4985658b46 |