0.1.4 • Published 9 years ago
sqltoes v0.1.4
sqltoes (sql to ES)
Writing elasticsearch commands is hard, writing SQL queries is...less hard
Motivation: Elasticsearch commands are confusing to write at a certain point. See the Elasticsearch reference for more help.
Installation
npm install sqltoesUse
sqlToES({select: ['sum(value)'], where: ['commodity = rice'], groupBy: ['description','year']})How it works (and what works so far)
Looks for three properties: select, where, and groupBy (currently requires them all)
- Anything in the
selectclause is ignored unless it is wrapped insum, min, max, or avgall of which become a final aggregation - The
whereclause supports two types of queries:[field] = [value]will be treated as a term filter.[field] in ([value1],value[2])will be treated as a terms filter.
- Anything in the
groupByclause is treated like the second example shown here.