Hi friends,
I'm migrating my Elasticsearch from 1.7 to 5.3, and have noticed inconsistencies in how range filters interact with geo_point data types. My query to 1.7 returns data successfully, while my query to 5.3 gives me nothing.
My search query to 1.7 (some fields redacted for company reasons) looks something like:
{
"query": {
"filtered": {
"filter": {
"and": {
"filters": [
{
"bool": {
"must": [
{
"and": {
"filters": [
{
"range": {
"x.y.z.lon": {
"from": null,
"to": -74.97070312500001,
"include_lower": true,
"include_upper": false
},
"_cache": false
}
}
]
}
}
],
"_cache": true
}
}
],
"_cache": false
}
}
}
}
}
My query to 5.3 looks something like this:
{
"from": 0,
"size": 0,
"query": {
"bool": {
"filter": [
{
"bool": {
"filter": [
{
"range": {
"x.y.z.lon": {
"gt": null,
"lt": "-74.97070312500001"
}
}
}
]
}
}
]
}
}
}
Here are my mappings for the relevant fields (extra fields trimmed out):
v1.7:
"my_17_mapping": {
"_routing": {
"required": true
},
"dynamic": "true",
"dynamic_templates": [
{
"strings_template": {
"mapping": {
"norms": {
"enabled": false
},
"index": "not_analyzed",
"type": "string",
"doc_values": true
},
"match_mapping_type": "string",
"match": "*"
}
},
{
"dynamic_default": {
"mapping": {
"norms": {
"enabled": false
},
"doc_values": true
},
"match_mapping_type": "*",
"match": "*"
}
}
],
"date_detection": false,
"properties": {
"x": {
"properties": {
"y": {
"properties": {
"z": {
"type": "geo_point",
"lat_lon": true,
"doc_values": true
}
}
}
}
}
}
}
}
v5.3:
{
"my_53_index": {
"mappings": {
"my_53_mapping": {
"dynamic": "true",
"_routing": {
"required": true
},
"dynamic_templates": [
{
"strings_template": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"doc_values": true,
"norms": false,
"type": "keyword"
}
}
},
{
"dynamic_default": {
"match": "*",
"mapping": {
"doc_values": true,
"norms": false
}
}
}
],
"date_detection": false,
"numeric_detection": false,
"properties": {
"x": {
"properties": {
"y": {
"properties": {
"z": {
"type": "geo_point"
},
}
}
}
}
}
}
}
}
}
Could anyone help me understand why these queries aren't returning the same thing? Perhaps a breaking change between the two versions or a problem with my mappings?