The index mapping being used is equivalent to this one (simplified):
PUT locations
{
"mappings": {
"properties": {
"geoshape": {
"type": "geo_shape"
}
}
}
}
There is a specific document in this index
POST locations/_bulk?refresh
{ "index": { "_id": "1" } }
{ "geoshape": { "type": "multilinestring", "coordinates": [[[24.7412109375, 59.45624336447568],[23.70849609375,56.64414704199467]], [[12.41455078125,51.358061573190916],[8.76708984375,53.12040528310657]]] } }
If I use the search API with a geo_bounding_box
query, I see the result as expected:
POST /locations/_search?_source=false
{
"query": {
"geo_bounding_box": {
"geoshape": {
"bottom_right": {
"lat": 35.029996,
"lon": 36.079102
},
"top_left": {
"lat": 62.714462,
"lon": -12.436523
}
}
}
},
"fields": ["geoshape"]
}
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "locations",
"_type": "_doc",
"_id": "1",
"_score": 1.0,
"fields": {
"geoshape": [
{
"coordinates": [
[
[
24.7412109375,
59.45624336447568
],
[
23.70849609375,
56.64414704199467
]
],
[
[
12.41455078125,
51.358061573190916
],
[
8.76708984375,
53.12040528310657
]
]
],
"type": "MultiLineString"
}
]
}
}
]
}
}
When I try and get the same result from the vector tiles search API, it is also returned correctly on the hits layer.
The issue I'm having is that this is working fine for an index created fresh for the testing (on version 7160299
), but for an index that was created on version 7150199
, the vector tiles API returns no hits, and the geo_shape
mapped field is also not returned as part of fields on the search API.
In essence, on the older index I'm seeing this behaviour:
POST /locations/_search?_source=false
{
"query": {
"geo_bounding_box": {
"geoshape": {
"bottom_right": {
"lat": 35.029996,
"lon": 36.079102
},
"top_left": {
"lat": 62.714462,
"lon": -12.436523
}
}
}
},
"fields": ["geoshape"]
}
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "locations",
"_type": "_doc",
"_id": "1",
"_score": 1.0
}
]
}
}
The field not being returned as part of the search API is sort of expected, based on this comment in the docs:
Due to the complex input structure and index representation of shapes, it is not currently possible to sort shapes or retrieve their fields directly. The
geo_shape
value is only retrievable through the_source
field
However, is it then related that this document does not show up on the vector tiles either? If so, is there a way to remedy this and make the old index behave like the new one, or is the behaviour of the new one not expected and the old one is actually behaving correctly?
I'm hoping to find an answer to this, as I would really like to make use of the vector tiles, but if the features just don't show up, it's not going to be possible.