Boolean would like to announce elastic-muto, a npm module for building elasticsearch queries using an easy and expressive syntax. The generated query can be customised as well!
Code Example
// Import the library
const muto = require('elastic-muto');
// muto.parse returns an elastic-builder BoolQuery object
const qry = muto.parse('["elasticsearch"] == "awesome" and ["unicorn"] exists');
qry.toJSON();
{
"bool": {
"must": [
{
"term": { "elasticsearch.keyword": "awesome" }
},
{
"exists": { "field": "unicorn" }
}
]
}
}
Demo
Project home
API documentation
The parser was originally developed for parsing filter conditions for the GET score API of Boolean.