Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geo_distance query options mismatch #108823

Open
craigtaverner opened this issue May 20, 2024 · 2 comments
Open

geo_distance query options mismatch #108823

craigtaverner opened this issue May 20, 2024 · 2 comments
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >docs General docs changes >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team

Comments

@craigtaverner
Copy link
Contributor

The documentation for the geo_distance query claims it supports the following options:

  • distance: examples all show strings with units, like "12km"
  • distance_type: ARC or PLANE
  • _name: Optional name field to identify the query (what does this mean)?
  • validation_method: IGNORE_MALFORMED, COERCE or STRICT (default)

Looking at the code there is parsing support for much more, so we did a code review to see what actually happens for the features that are documented and for undocumented, but coded options as well:

field docs parsing lucene query
_name "Optional name field to identify the query" Parsed as queryName distance query gets wrapped by NamedQuery
_boost N/A Parsed as boost distance query gets wrapped by a BoostQuery
distance "12km" - link to units docs parsed as float or string, within the specified units (default meters), and then converted to the unit specified below (default meters) assumes distance in meters
unit N/A parsed according to unit docs, and used to convert distance value Invalid, if we specify anything other than meters (default)
distance_type Described as arc (default) or plane parsed as arc or plane Completely unused in Lucene query, and lucene Circle2D uses haversine distance internally, which is what arc implies
validation_method IGNORE_MALFORMED, COERCE or STRICT (default) Parsed as described If NOT IGNORE_MALFORMED, then exception is thrown on malformed center point, if COERCE, then point is normalized before passing to Lucene
ignore_unmapped N/A Parsed as true/false (default false) If true and field is not mapped, use MatchNoDocsQuery, else throw exception

From this analysis it would seem we should:

  • Remove support and documentation for:
    • distance_type (silently ignored, will be arc no matter what the user puts here)
    • unit (will result in incorrect answers for anything other than meters)
  • Add documentation for:
    • ignore_unmapped
    • boost
@craigtaverner craigtaverner added >docs General docs changes >non-issue :Analytics/Geo Indexing, search aggregations of geo points and shapes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels May 20, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Docs Meta label for docs team label May 20, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >docs General docs changes >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team
Projects
None yet
Development

No branches or pull requests

2 participants