Skip to content
This repository was archived by the owner on May 14, 2019. It is now read-only.

Latest commit

 

History

History
22 lines (18 loc) · 967 Bytes

custom-conf.md

File metadata and controls

22 lines (18 loc) · 967 Bytes

Custom configuration

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.