Path parameters
- index
string | array[string] Required Comma-separated list of data streams, indices, or aliases to search
- field
string Required Field containing geospatial data to return
- zoom
number Required Zoom level for the vector tile to search
- x
number Required X coordinate for the vector tile to search
- y
number Required Y coordinate for the vector tile to search
Query parameters
- exact_bounds
boolean If
false
, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a geo_bounds aggregation. The aggregation runs on values that intersect the // tile with wrap_longitude set to false. The resulting bounding box may be larger than the vector tile. - extent
number The size, in pixels, of a side of the tile. Vector tiles are square with equal sides.
- grid_agg
string Aggregation used to create a grid for
field
.Values are
geotile
orgeohex
. - grid_precision
number Additional zoom levels available through the aggs layer. For example, if is 7 and grid_precision is 8, you can zoom in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer.
- grid_type
string Determines the geometry type for features in the aggs layer. In the aggs layer, each feature represents a geotile_grid cell. If 'grid' each feature is a Polygon of the cells bounding box. If 'point' each feature is a Point that is the centroid of the cell.
Values are
grid
,point
, orcentroid
. - size
number Maximum number of features to return in the hits layer. Accepts 0-10000. If 0, results don't include the hits layer.
- with_labels
boolean If
true
, the hits and aggs layers will contain additional point features representing suggested label positions for the original features.Point
andMultiPoint
features will have one of the points selected.Polygon
andMultiPolygon
features will have a single point generated, either the centroid, if it is within the polygon, or another point within the polygon selected from the sorted triangle-tree.LineString
features will likewise provide a roughly central point selected from the triangle-tree.- The aggregation results will provide one central point for each aggregation bucket.
All attributes from the original features will also be copied to the new label features. In addition, the new features will be distinguishable using the tag
_mvt_label_position
.
Body
- aggs
object Sub-aggregations for the geotile_grid.
It supports the following aggregation types:
avg
boxplot
cardinality
extended stats
max
median absolute deviation
min
percentile
percentile-rank
stats
sum
value count
The aggregation names can't start with
_mvt_
. The_mvt_
prefix is reserved for internal aggregations. - buffer
number The size, in pixels, of a clipping buffer outside the tile. This allows renderers to avoid outline artifacts from geometries that extend past the extent of the tile.
- exact_bounds
boolean If
false
, the meta layer's feature is the bounding box of the tile. Iftrue
, the meta layer's feature is a bounding box resulting from ageo_bounds
aggregation. The aggregation runs on values that intersect the<zoom>/<x>/<y>
tile withwrap_longitude
set tofalse
. The resulting bounding box may be larger than the vector tile. - extent
number The size, in pixels, of a side of the tile. Vector tiles are square with equal sides.
- fields
string | array[string] - grid_agg
string Values are
geotile
orgeohex
. - grid_precision
number Additional zoom levels available through the aggs layer. For example, if
<zoom>
is7
andgrid_precision
is8
, you can zoom in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer. - grid_type
string Values are
grid
,point
, orcentroid
. - query
object An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation - runtime_mappings
object - size
number The maximum number of features to return in the hits layer. Accepts 0-10000. If 0, results don't include the hits layer.
- track_total_hits
boolean | number Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits.
- with_labels
boolean If
true
, the hits and aggs layers will contain additional point features representing suggested label positions for the original features.Point
andMultiPoint
features will have one of the points selected.Polygon
andMultiPolygon
features will have a single point generated, either the centroid, if it is within the polygon, or another point within the polygon selected from the sorted triangle-tree.LineString
features will likewise provide a roughly central point selected from the triangle-tree.- The aggregation results will provide one central point for each aggregation bucket.
All attributes from the original features will also be copied to the new label features. In addition, the new features will be distinguishable using the tag
_mvt_label_position
.
GET museums/_mvt/location/13/4207/2692
{
"grid_agg": "geotile",
"grid_precision": 2,
"fields": [
"name",
"price"
],
"query": {
"term": {
"included": true
}
},
"aggs": {
"min_price": {
"min": {
"field": "price"
}
},
"max_price": {
"max": {
"field": "price"
}
},
"avg_price": {
"avg": {
"field": "price"
}
}
}
}
resp = client.search_mvt(
index="museums",
field="location",
zoom="13",
x="4207",
y="2692",
grid_agg="geotile",
grid_precision=2,
fields=[
"name",
"price"
],
query={
"term": {
"included": True
}
},
aggs={
"min_price": {
"min": {
"field": "price"
}
},
"max_price": {
"max": {
"field": "price"
}
},
"avg_price": {
"avg": {
"field": "price"
}
}
},
)
const response = await client.searchMvt({
index: "museums",
field: "location",
zoom: 13,
x: 4207,
y: 2692,
grid_agg: "geotile",
grid_precision: 2,
fields: ["name", "price"],
query: {
term: {
included: true,
},
},
aggs: {
min_price: {
min: {
field: "price",
},
},
max_price: {
max: {
field: "price",
},
},
avg_price: {
avg: {
field: "price",
},
},
},
});
response = client.search_mvt(
index: "museums",
field: "location",
zoom: "13",
x: "4207",
y: "2692",
body: {
"grid_agg": "geotile",
"grid_precision": 2,
"fields": [
"name",
"price"
],
"query": {
"term": {
"included": true
}
},
"aggs": {
"min_price": {
"min": {
"field": "price"
}
},
"max_price": {
"max": {
"field": "price"
}
},
"avg_price": {
"avg": {
"field": "price"
}
}
}
}
)
$resp = $client->searchMvt([
"index" => "museums",
"field" => "location",
"zoom" => "13",
"x" => "4207",
"y" => "2692",
"body" => [
"grid_agg" => "geotile",
"grid_precision" => 2,
"fields" => array(
"name",
"price",
),
"query" => [
"term" => [
"included" => true,
],
],
"aggs" => [
"min_price" => [
"min" => [
"field" => "price",
],
],
"max_price" => [
"max" => [
"field" => "price",
],
],
"avg_price" => [
"avg" => [
"field" => "price",
],
],
],
],
]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"grid_agg":"geotile","grid_precision":2,"fields":["name","price"],"query":{"term":{"included":true}},"aggs":{"min_price":{"min":{"field":"price"}},"max_price":{"max":{"field":"price"}},"avg_price":{"avg":{"field":"price"}}}}' "$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692"
{
"grid_agg": "geotile",
"grid_precision": 2,
"fields": [
"name",
"price"
],
"query": {
"term": {
"included": true
}
},
"aggs": {
"min_price": {
"min": {
"field": "price"
}
},
"max_price": {
"max": {
"field": "price"
}
},
"avg_price": {
"avg": {
"field": "price"
}
}
}
}
{
"hits": {
"extent": 4096,
"version": 2,
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
3208,
3864
]
},
"properties": {
"_id": "1",
"_index": "museums",
"name": "NEMO Science Museum",
"price": 1750
},
"type": 1
},
{
"geometry": {
"type": "Point",
"coordinates": [
3429,
3496
]
},
"properties": {
"_id": "3",
"_index": "museums",
"name": "Nederlands Scheepvaartmuseum",
"price": 1650
},
"type": 1
},
{
"geometry": {
"type": "Point",
"coordinates": [
3429,
3496
]
},
"properties": {
"_id": "4",
"_index": "museums",
"name": "Amsterdam Centre for Architecture",
"price": 0
},
"type": 1
}
]
},
"aggs": {
"extent": 4096,
"version": 2,
"features": [
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
3072,
3072
],
[
4096,
3072
],
[
4096,
4096
],
[
3072,
4096
],
[
3072,
3072
]
]
]
},
"properties": {
"_count": 3,
"max_price.value": 1750.0,
"min_price.value": 0.0,
"avg_price.value": 1133.3333333333333
},
"type": 3
}
]
},
"meta": {
"extent": 4096,
"version": 2,
"features": [
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
0,
0
],
[
4096,
0
],
[
4096,
4096
],
[
0,
4096
],
[
0,
0
]
]
]
},
"properties": {
"_shards.failed": 0,
"_shards.skipped": 0,
"_shards.successful": 1,
"_shards.total": 1,
"aggregations._count.avg": 3.0,
"aggregations._count.count": 1,
"aggregations._count.max": 3.0,
"aggregations._count.min": 3.0,
"aggregations._count.sum": 3.0,
"aggregations.avg_price.avg": 1133.3333333333333,
"aggregations.avg_price.count": 1,
"aggregations.avg_price.max": 1133.3333333333333,
"aggregations.avg_price.min": 1133.3333333333333,
"aggregations.avg_price.sum": 1133.3333333333333,
"aggregations.max_price.avg": 1750.0,
"aggregations.max_price.count": 1,
"aggregations.max_price.max": 1750.0,
"aggregations.max_price.min": 1750.0,
"aggregations.max_price.sum": 1750.0,
"aggregations.min_price.avg": 0.0,
"aggregations.min_price.count": 1,
"aggregations.min_price.max": 0.0,
"aggregations.min_price.min": 0.0,
"aggregations.min_price.sum": 0.0,
"hits.max_score": 0.0,
"hits.total.relation": "eq",
"hits.total.value": 3,
"timed_out": false,
"took": 2
},
"type": 3
}
]
}
}