graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
35 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGeoBoundingBoxITC = void 0;
const utils_1 = require("../../../utils");
const FieldNames_1 = require("../../Commons/FieldNames");
const Geo_1 = require("../../Commons/Geo");
function getGeoBoundingBoxITC(opts) {
const name = (0, utils_1.getTypeName)('QueryGeoBoundingBox', opts);
const description = (0, utils_1.desc)(`
A query allowing to filter hits based on a point location using a bounding box.
Requires the geo_point Mapping.
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html)
`);
const subName = (0, utils_1.getTypeName)('QueryGeoBoundingBoxSettings', opts);
const fields = (0, FieldNames_1.getGeoPointAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({
name: subName,
fields: {
top_left: (0, Geo_1.getGeoPointFC)(opts),
bottom_right: (0, Geo_1.getGeoPointFC)(opts),
},
})));
if (typeof fields === 'object') {
return opts.getOrCreateITC(name, () => ({
name,
description,
fields,
}));
}
return {
type: 'JSON',
description,
};
}
exports.getGeoBoundingBoxITC = getGeoBoundingBoxITC;
//# sourceMappingURL=GeoBoundingBox.js.map