graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
34 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCardinalityITC = void 0;
const utils_1 = require("../../../utils");
const Script_1 = require("../../Commons/Script");
const FieldNames_1 = require("../../Commons/FieldNames");
function getCardinalityITC(opts) {
const name = (0, utils_1.getTypeName)('AggsCardinality', opts);
const description = (0, utils_1.desc)(`
A single-value metrics aggregation that calculates an approximate count
of distinct values. Values can be extracted either from specific fields
in the document or generated by a script.
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html)
`);
return opts.getOrCreateITC(name, () => ({
name,
description,
fields: {
field: (0, FieldNames_1.getAllFields)(opts),
precision_threshold: {
type: 'Int',
defaultValue: 3000,
description: (0, utils_1.desc)(`
Allows to trade memory for accuracy, and defines a unique count
below which counts are expected to be close to accurate.
`),
},
missing: 'String',
script: () => (0, Script_1.getCommonsScriptITC)(opts),
},
}));
}
exports.getCardinalityITC = getCardinalityITC;
//# sourceMappingURL=Cardinality.js.map