graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
38 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTermITC = void 0;
const utils_1 = require("../../../utils");
const FieldNames_1 = require("../../Commons/FieldNames");
function getTermITC(opts) {
const name = (0, utils_1.getTypeName)('QueryTerm', opts);
const description = (0, utils_1.desc)(`
Find documents which contain the exact term specified
in the field specified.
{ fieldName: value } or { fieldName: { value: value, boost: 2.0 } }
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html)
`);
const subName = (0, utils_1.getTypeName)('QueryTermSettings', opts);
const fields = (0, FieldNames_1.getAllAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({
name: subName,
fields: {
value: 'JSON!',
boost: 'Float',
fuzziness: 'Int',
prefix_length: 'Int',
max_expansions: 'Int',
},
})));
if (typeof fields === 'object') {
return opts.getOrCreateITC(name, () => ({
name,
description,
fields,
}));
}
return {
type: 'JSON',
description,
};
}
exports.getTermITC = getTermITC;
//# sourceMappingURL=Term.js.map