Query builder for ELQ, the ELLIO Search API query language
Project description
ellio-elq
Query builder for ELQ, the query language of the ELLIO Search API. Field
metadata and operator capabilities are generated from the Search API field
catalog; an operator a field's type does not support raises ValueError
naming the field, its type, and the allowed operators. No dependencies;
Python 3.10+.
Install
pip install ellio-elq
Usage
from ellio_elq import and_, f, not_, or_
query = and_(
or_(f("src.geo.country.code").term("CN"), f("src.geo.country.code").term("RU")),
not_(f("spoofable").term(True)),
f("network.port").in_(22, 23),
).build()
# (src.geo.country.code:"CN" OR src.geo.country.code:"RU") AND NOT spoofable:true AND network.port IN (22, 23)
f("last_seen").within("7d").build() # last_seen:7d
f("ip").term("203.0.113.0/24").build() # ip:203.0.113.0/24
Operators map to methods: term (:), not_term (!:), match (~:),
not_match (!~:), eq/ne/gt/gte/lt/lte, in_,
range ([a TO b]), exists, not_exists, and within for relative
time windows on date fields.
The builder emits the canonical text form produced by the Search API's
query printer: string values are quoted (single quotes when the value
contains a double quote; ELQ has no escape sequences), while numbers,
booleans, IPs, CIDRs, dates, and relative times stay bare. Parentheses
appear exactly where mixed AND/OR precedence requires them. Invalid
combinations fail early: unsupported operators and non-IP values on the
ip field raise ValueError. raw() is the escape hatch for query text
the builder cannot express; it is parenthesized when composed.
More of the surface:
# Time windows, ranges, and comparisons
f("last_seen").within("7d") # last_seen:7d
f("first_seen").range("2026-06-01", "2026-06-30") # first_seen:[2026-06-01 TO 2026-06-30]
f("active_days").gt(30) # active_days > 30
# Presence, analysed-text match, wildcards
f("cve").exists() # cve exists
f("http.user_agent").match("zgrab") # http.user_agent~:"zgrab"
f("rdns").term("*.censys-scanner.com") # rdns:"*.censys-scanner.com"
Query the Search API
The built string goes into the q parameter:
import os
import requests
res = requests.get(
"https://api.ellio.tech/v1/cti/search",
params={"q": query},
headers={"apikey": os.environ["ELLIO_API_KEY"]},
)
The language
The full ELQ reference (operators, bare indicators, every searchable field)
lives at https://docs.ellio.tech/threat-intel/elq. Built queries go into
the q parameter of the Search API endpoints.
Conformance
The test suite includes a cross-language conformance table shared with the
TypeScript SDK (@ellio_tech/elq): both SDKs must produce byte-identical output
for every case, and each expected string is verified against the server
grammar before release.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ellio_elq-0.1.2.tar.gz.
File metadata
- Download URL: ellio_elq-0.1.2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adc56af8f4dcb71c273d9a0b978b5d0dc2be7e916226cf65f69b8d7915daefd9
|
|
| MD5 |
ce01c09a3a41e41031488228d25bde3e
|
|
| BLAKE2b-256 |
f315bcff7a452a67e10d543ccd695a8c7f8db8f4943ddc2aa960f967c9b218f9
|
Provenance
The following attestation bundles were made for ellio_elq-0.1.2.tar.gz:
Publisher:
promote.yml on ELLIO-Technology/elq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ellio_elq-0.1.2.tar.gz -
Subject digest:
adc56af8f4dcb71c273d9a0b978b5d0dc2be7e916226cf65f69b8d7915daefd9 - Sigstore transparency entry: 2172706164
- Sigstore integration time:
-
Permalink:
ELLIO-Technology/elq@5eb5ce3eede7083617355858752e7c504d798c24 -
Branch / Tag:
refs/heads/stage - Owner: https://github.com/ELLIO-Technology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote.yml@5eb5ce3eede7083617355858752e7c504d798c24 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ellio_elq-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ellio_elq-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1beeec63660858f06be1a2c0b294d225d490822d4b002b7e4a0f5756bcd026b
|
|
| MD5 |
53f29cb895cbe0faed39642b19a43e11
|
|
| BLAKE2b-256 |
907930de8e801895287c438f22622880f828ad6016070d34f4ee262218e79faa
|
Provenance
The following attestation bundles were made for ellio_elq-0.1.2-py3-none-any.whl:
Publisher:
promote.yml on ELLIO-Technology/elq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ellio_elq-0.1.2-py3-none-any.whl -
Subject digest:
c1beeec63660858f06be1a2c0b294d225d490822d4b002b7e4a0f5756bcd026b - Sigstore transparency entry: 2172706177
- Sigstore integration time:
-
Permalink:
ELLIO-Technology/elq@5eb5ce3eede7083617355858752e7c504d798c24 -
Branch / Tag:
refs/heads/stage - Owner: https://github.com/ELLIO-Technology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote.yml@5eb5ce3eede7083617355858752e7c504d798c24 -
Trigger Event:
workflow_dispatch
-
Statement type: