parent
3b8701199f
commit
5b34bec92a
|
@ -1,6 +1,8 @@
|
||||||
[[geohash-precision]]
|
[[geohash-precision]]
|
||||||
=== `geohash_precision`
|
=== `geohash_precision`
|
||||||
|
|
||||||
|
deprecated[5.0.0, Will be removed in the next major version.]
|
||||||
|
|
||||||
Geohashes are a form of lat/lon encoding which divides the earth up into
|
Geohashes are a form of lat/lon encoding which divides the earth up into
|
||||||
a grid. Each cell in this grid is represented by a geohash string. Each
|
a grid. Each cell in this grid is represented by a geohash string. Each
|
||||||
cell in turn can be further subdivided into smaller cells which are
|
cell in turn can be further subdivided into smaller cells which are
|
||||||
|
@ -19,7 +21,7 @@ It accepts:
|
||||||
If a distance is specified, it will be translated to the smallest
|
If a distance is specified, it will be translated to the smallest
|
||||||
geohash-length that will provide the requested resolution.
|
geohash-length that will provide the requested resolution.
|
||||||
|
|
||||||
For example:
|
For example, using this mapping:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
@ -37,8 +39,16 @@ PUT my_index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
// TEST[warning:geo_point geohash_precision parameter is deprecated and will be removed in the next major release]
|
||||||
|
// TEST[warning:geo_point geohash_prefix parameter is deprecated and will be removed in the next major release]
|
||||||
|
// TEST[warning:geo_point geohash parameter is deprecated and will be removed in the next major release]
|
||||||
|
|
||||||
PUT my_index/my_type/1
|
You can issue this index and query:
|
||||||
|
[source,js]
|
||||||
|
--------------------------------------------------
|
||||||
|
PUT my_index/my_type/1?refresh
|
||||||
{
|
{
|
||||||
"location": {
|
"location": {
|
||||||
"lat": 41.12,
|
"lat": 41.12,
|
||||||
|
@ -57,4 +67,6 @@ GET my_index/_search?fielddata_fields=location.geohash
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
|
// TEST[continued]
|
||||||
|
|
||||||
<1> A `geohash_precision` of 6 equates to geohash cells of approximately 1.26km x 0.6km
|
<1> A `geohash_precision` of 6 equates to geohash cells of approximately 1.26km x 0.6km
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
[[geohash-prefix]]
|
[[geohash-prefix]]
|
||||||
=== `geohash_prefix`
|
=== `geohash_prefix`
|
||||||
|
|
||||||
|
deprecated[5.0.0, Will be removed in the next major version.]
|
||||||
|
|
||||||
|
|
||||||
Geohashes are a form of lat/lon encoding which divides the earth up into
|
Geohashes are a form of lat/lon encoding which divides the earth up into
|
||||||
a grid. Each cell in this grid is represented by a geohash string. Each
|
a grid. Each cell in this grid is represented by a geohash string. Each
|
||||||
cell in turn can be further subdivided into smaller cells which are
|
cell in turn can be further subdivided into smaller cells which are
|
||||||
|
@ -37,7 +40,13 @@ PUT my_index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
--------------------------------------------------
|
||||||
|
// TEST[warning:geo_point geohash_precision parameter is deprecated and will be removed in the next major release]
|
||||||
|
// TEST[warning:geo_point geohash_prefix parameter is deprecated and will be removed in the next major release]
|
||||||
|
// TEST[warning:geo_point geohash parameter is deprecated and will be removed in the next major release]
|
||||||
|
|
||||||
|
[source,js]
|
||||||
|
--------------------------------------------------
|
||||||
PUT my_index/my_type/1
|
PUT my_index/my_type/1
|
||||||
{
|
{
|
||||||
"location": {
|
"location": {
|
||||||
|
@ -61,4 +70,4 @@ GET my_index/_search?fielddata_fields=location.geohash
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
|
// TEST[continued]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
[[geohash]]
|
[[geohash]]
|
||||||
=== `geohash`
|
=== `geohash`
|
||||||
|
|
||||||
|
deprecated[5.0.0, Will be removed in the next major version.]
|
||||||
|
|
||||||
Geohashes are a form of lat/lon encoding which divides the earth up into
|
Geohashes are a form of lat/lon encoding which divides the earth up into
|
||||||
a grid. Each cell in this grid is represented by a geohash string. Each
|
a grid. Each cell in this grid is represented by a geohash string. Each
|
||||||
cell in turn can be further subdivided into smaller cells which are
|
cell in turn can be further subdivided into smaller cells which are
|
||||||
|
@ -17,7 +19,7 @@ as, eg `.geohash`. The length of the geohash is controlled by the
|
||||||
If the <<geohash-prefix,`geohash_prefix`>> option is enabled, the `geohash`
|
If the <<geohash-prefix,`geohash_prefix`>> option is enabled, the `geohash`
|
||||||
option will be enabled automatically.
|
option will be enabled automatically.
|
||||||
|
|
||||||
For example:
|
For example, with this mapping:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
@ -34,9 +36,15 @@ PUT my_index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
// TEST[warning:geo_point geohash parameter is deprecated and will be removed in the next major release]
|
||||||
|
|
||||||
|
You can index a document and use this query:
|
||||||
|
|
||||||
PUT my_index/my_type/1
|
[source,js]
|
||||||
|
--------------------------------------------------
|
||||||
|
PUT my_index/my_type/1?refresh
|
||||||
{
|
{
|
||||||
"location": {
|
"location": {
|
||||||
"lat": 41.12,
|
"lat": 41.12,
|
||||||
|
@ -54,6 +62,8 @@ GET my_index/_search?fielddata_fields=location.geohash <2>
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
|
// TEST[continued]
|
||||||
|
|
||||||
<1> A `location.geohash` field will be indexed for each geo-point.
|
<1> A `location.geohash` field will be indexed for each geo-point.
|
||||||
<2> The geohash can be retrieved with <<doc-values,`doc_values`>>.
|
<2> The geohash can be retrieved with <<doc-values,`doc_values`>>.
|
||||||
<3> A <<query-dsl-prefix-query,`prefix`>> query can find all geohashes which start with a particular prefix.
|
<3> A <<query-dsl-prefix-query,`prefix`>> query can find all geohashes which start with a particular prefix.
|
||||||
|
@ -66,5 +76,3 @@ A `prefix` query on geohashes is expensive. Instead, consider using the
|
||||||
instead of on every query.
|
instead of on every query.
|
||||||
|
|
||||||
============================================
|
============================================
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ PUT my_index
|
||||||
// TEST[warning:geo_point lat_lon parameter is deprecated and will be removed in the next major release]
|
// TEST[warning:geo_point lat_lon parameter is deprecated and will be removed in the next major release]
|
||||||
<1> Setting `lat_lon` to true indexes the geo-point in the `location.lat` and `location.lon` fields.
|
<1> Setting `lat_lon` to true indexes the geo-point in the `location.lat` and `location.lon` fields.
|
||||||
|
|
||||||
Allows these actions:
|
With this document:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
@ -45,8 +45,14 @@ PUT my_index/my_type/1?refresh
|
||||||
"lon": -71.34
|
"lon": -71.34
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
// TEST[continued]
|
||||||
|
|
||||||
|
Allows this query:
|
||||||
|
|
||||||
|
[source,js]
|
||||||
|
--------------------------------------------------
|
||||||
GET my_index/_search
|
GET my_index/_search
|
||||||
{
|
{
|
||||||
"query": {
|
"query": {
|
||||||
|
@ -63,6 +69,7 @@ GET my_index/_search
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
// TEST[continued]
|
// TEST[continued]
|
||||||
|
// TEST[warning:Deprecated field [optimize_bbox] used, replaced by [no replacement: `optimize_bbox` is no longer supported due to recent improvements]]
|
||||||
<1> The `indexed` option tells the geo-distance query to use the inverted index instead of the in-memory calculation.
|
<1> The `indexed` option tells the geo-distance query to use the inverted index instead of the in-memory calculation.
|
||||||
|
|
||||||
Whether the in-memory or indexed operation performs better depends both on
|
Whether the in-memory or indexed operation performs better depends both on
|
||||||
|
|
|
@ -30,7 +30,9 @@ PUT /my_index
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
// TESTSETUP
|
// TEST[warning:geo_point geohash parameter is deprecated and will be removed in the next major release]
|
||||||
|
// TEST[warning:geo_point geohash_precision parameter is deprecated and will be removed in the next major release]
|
||||||
|
// TEST[warning:geo_point geohash_prefix parameter is deprecated and will be removed in the next major release]
|
||||||
|
|
||||||
The geohash cell can defined by all formats of `geo_points`. If such a cell is
|
The geohash cell can defined by all formats of `geo_points`. If such a cell is
|
||||||
defined by a latitude and longitude pair the size of the cell needs to be
|
defined by a latitude and longitude pair the size of the cell needs to be
|
||||||
|
@ -67,6 +69,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
|
// TEST[continued]
|
||||||
|
|
||||||
[float]
|
[float]
|
||||||
==== Ignore Unmapped
|
==== Ignore Unmapped
|
||||||
|
|
Loading…
Reference in New Issue