graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
37 lines • 1.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRangeITC = void 0;
const utils_1 = require("../../../utils");
const FieldNames_1 = require("../../Commons/FieldNames");
function getRangeITC(opts) {
const name = (0, utils_1.getTypeName)('QueryRange', opts);
const description = (0, utils_1.desc)(`
Matches documents with fields that have terms within a certain range.
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html)
`);
const subName = (0, utils_1.getTypeName)('QueryRangeSettings', opts);
const fields = (0, FieldNames_1.getAllAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({
name: subName,
fields: {
gt: 'JSON',
gte: 'JSON',
lt: 'JSON',
lte: 'JSON',
boost: 'Float',
relation: 'String',
},
})));
if (typeof fields === 'object') {
return opts.getOrCreateITC(name, () => ({
name,
description,
fields,
}));
}
return {
type: 'JSON',
description,
};
}
exports.getRangeITC = getRangeITC;
//# sourceMappingURL=Range.js.map