graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
35 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGeoPolygonITC = void 0;
const utils_1 = require("../../../utils");
const FieldNames_1 = require("../../Commons/FieldNames");
const Geo_1 = require("../../Commons/Geo");
function getGeoPolygonITC(opts) {
const name = (0, utils_1.getTypeName)('QueryGeoPolygon', opts);
const description = (0, utils_1.desc)(`
A query allowing to include hits that only fall within a polygon of points.
Requires the geo_point Mapping.
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-query.html)
`);
const subName = (0, utils_1.getTypeName)('QueryGeoPolygonSettings', opts);
const fields = (0, FieldNames_1.getGeoPointAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({
name: subName,
fields: {
points: [(0, Geo_1.getGeoPointFC)(opts)],
validation_method: 'String',
},
})));
if (typeof fields === 'object') {
return opts.getOrCreateITC(name, () => ({
name,
description,
fields,
}));
}
return {
type: 'JSON',
description,
};
}
exports.getGeoPolygonITC = getGeoPolygonITC;
//# sourceMappingURL=GeoPolygon.js.map