graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
30 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGeoDistanceITC = void 0;
const utils_1 = require("../../../utils");
const Geo_1 = require("../../Commons/Geo");
const Float_1 = require("../../Commons/Float");
const FieldNames_1 = require("../../Commons/FieldNames");
function getGeoDistanceITC(opts) {
const name = (0, utils_1.getTypeName)('AggsGeoDistance', opts);
const description = (0, utils_1.desc)(`
A multi-bucket aggregation that works on geo_point fields. The user can
define a point of origin and a set of distance range buckets.
The aggregation evaluate the distance of each document value from the
origin point and determines the buckets it belongs to based on the ranges
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geodistance-aggregation.html)
`);
return opts.getOrCreateITC(name, () => ({
name,
description,
fields: {
field: (0, FieldNames_1.getGeoPointFields)(opts),
origin: (0, Geo_1.getGeoPointFC)(opts),
ranges: [(0, Float_1.getFloatRangeITC)(opts)],
unit: (0, Geo_1.getDistanceUnitFC)(opts),
distance_type: (0, Geo_1.getDistanceCalculationModeFC)(opts),
},
}));
}
exports.getGeoDistanceITC = getGeoDistanceITC;
//# sourceMappingURL=GeoDistance.js.map