The queries generated by elastic-muto
can be completely customised.
cosmiconfig is used to load the config.
A js file, with the file name muto.config.js
, will be loaded and used if present.
The file should export a plain object with a function which returns an elastic-builder
BoolQuery
object.
You can define(and override) any of the functions defined in src/query-builder-def.js
Example:
'use strict';
module.exports = {
// Condition builder for property exists
exists(key) {
return bob.existsQuery(`shiny_${key}`);
},
};
You can also customise the construction of Property Keys. Check out this example which defines a custom config.