Elastic-muto - Easy expressive search queries for Elasticsearch


(Suhas Karanth) #1

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

https://muto.js.org

Project home

API documentation

https://muto.js.org/docs

The parser was originally developed for parsing filter conditions for the GET score API of Boolean.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.