From b01eb6fadef65baee886f9a08bd31d431f997870 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Fri, 11 May 2018 12:19:01 -0400 Subject: [PATCH 1/2] Docs: document precision limitations of geo_bounding_box The geo_bounding_box query might produce false positives alongside the right and upper edges and false negatives alongside left and bottom edges. This commit documents the behavior and defines the maximum error. Closes #29196 --- .../query-dsl/geo-bounding-box-query.asciidoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc index a1b427acf2718..1b013adcd81f1 100644 --- a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc +++ b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc @@ -329,3 +329,16 @@ and will not match any documents for this query. This can be useful when querying multiple indexes which might have different mappings. When set to `false` (the default value) the query will throw an exception if the field is not mapped. + +[float] +==== Notes on Precision + +Geopoints have limited precision and are always rounded down during index time. +During the query time, upper boundaries of the bounding boxes are rounded down, +while lower boundaries are rounded up. As a result, the points along on the +lower bounds (bottom and left edges of the bounding box) might not make it into +the bounding box due to the rounding error. At the same time points alongside +the upper bounds (top and right edges) might be selected by the query even if +they are located slightly outside the edge. The rounding error should be less +than 4.20e-8 degrees on the latitude and less than 8.39e-8 degrees on the +longitude. From 778a53546ad3a5d77f4d1132e3c0da24bd0f26ac Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Mon, 14 May 2018 09:37:03 -0400 Subject: [PATCH 2/2] Add the information about the maximum expected error --- docs/reference/query-dsl/geo-bounding-box-query.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc index 1b013adcd81f1..21a689703e01e 100644 --- a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc +++ b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc @@ -341,4 +341,4 @@ the bounding box due to the rounding error. At the same time points alongside the upper bounds (top and right edges) might be selected by the query even if they are located slightly outside the edge. The rounding error should be less than 4.20e-8 degrees on the latitude and less than 8.39e-8 degrees on the -longitude. +longitude, which translates to less than 1cm error even at the equator.