
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Elasticsearch Easy Query Builder
Builds simple Elasticsearch queries using standard programming syntax. Not all queries that can be expressed in Elasticsearch are possible, but those that are possible are simple to write. This can be used to expose Elasticsearch queries to a moderately technical user with little extra training.
es-eql is your typical NPM package.
npm install --save es-eql
import * as elasticsearch from "elasticsearch";
import * as eseql from "es-eql";
const es = new elasticsearch.Client({
apiVersion: "5.1",
hosts: "myhostname"
});
es.search({
index: "myindex",
type: "mytype",
body: eseql.buildElasticsearchQuery("environment == 'production' && (tag == 'http' || tag == 'ftp')")
}).then(result => {
console.log("search result", result.hits.hits.map(d => d._source));
}, error => {
console.log("search error", error);
});
The following operators are supported:
symbol | operation |
---|---|
() | operation grouping |
! | logical negation |
&& | logical and |
|| | logical or |
== | logical equals |
!= | logical not equals |
*= | wildcard match |
!*= | wildcard not match |
~= | fuzzy match |
!~= | fuzzy not match |
< | less than |
<= | less than or equals |
> | greater than |
>= | greater than or equals |
All comparison operators must work against a literal value. For example threat.level > 5
and flavor == 'chocolate'
are valid. flavor == color
is not valid because Elasticsearch does not allow comparing values within a document.
Existence of a field can be required with the field name and no operator (JavaScript-style truthiness). Non existence of a field can be required by negating the field. eg: environment
, !environment
.
buildElasticsearchQuery
accepts an options param that can verify whether a field name is valid.
eg:
const options = {
fieldVerifier: function (field) {
switch (field) {
case "x":
case "z.a":
case "z.b":
case "z.c":
return true;
}
return false;
}
};
// valid
eseql.buildElasticsearchQuery("x == 1", options);
eseql.buildElasticsearchQuery("z.a == 1 && z.b != -2", options);
// invalid
eseql.buildElasticsearchQuery("y == 9", options);
FAQs
Elasticsearch Easy Query Builder
The npm package es-eql receives a total of 1 weekly downloads. As such, es-eql popularity was classified as not popular.
We found that es-eql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.