GeoDistanceQuery (geo-queries/geo-distance-query.js)

elastic-builder · src/queries/geo-queries/geo-distance-query.js · javascript · MIT
search

Provides a fluent interface for constructing Elasticsearch geo-distance queries to filter documents by proximity to a point.

// Source: https://github.com/sudo-suhas/elastic-builder | License: MIT | Copyright 2017 Suhas Karanth
// Provided via justclaw.it.com; keep this notice with the code.
'use strict';

const _ = require('../../_');

const {
    GeoPoint,
    util: { checkType, invalidParam }
} = require('../../core');

const GeoQueryBase = require('./geo-query-base');

const ES_REF_URL =
    'https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html';

const invalidDistanceTypeParam = invalidParam(
    ES_REF_URL,
    'distance_type',
    "'plane' or 'arc'"
);

/**
 * Filters documents that include only hits that exists within a specific distance from a geo point.
 *
 * [Elasticsearch reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key