graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
35 lines • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMatchPhraseITC = void 0;
const utils_1 = require("../../../utils");
const FieldNames_1 = require("../../Commons/FieldNames");
function getMatchPhraseITC(opts) {
const name = (0, utils_1.getTypeName)('QueryMatchPhrase', opts);
const description = (0, utils_1.desc)(`
The match_phrase query analyzes the text and creates a phrase query out
of the analyzed text.
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html)
`);
const subName = (0, utils_1.getTypeName)('QueryMatchPhraseSettings', opts);
const fields = (0, FieldNames_1.getAnalyzedAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({
name: subName,
fields: {
query: 'String',
analyzer: 'String',
boost: 'Float',
},
})));
if (typeof fields === 'object') {
return opts.getOrCreateITC(name, () => ({
name,
description,
fields,
}));
}
return {
type: 'JSON',
description,
};
}
exports.getMatchPhraseITC = getMatchPhraseITC;
//# sourceMappingURL=MatchPhrase.js.map