Thank you for your answer, @dadoonet.
I tried what follows, but it doesn't seem to work as expected:
DELETE test-loc
PUT test-loc
{
"mappings": {
"doc": {
"dynamic_templates": [
{
"geo_mapping_1": {
"match_mapping_type": "string",
"match": "*location",
"mapping": {
"type": "geopoint"
} } }
] } }
}
GET test-loc
PUT test-loc/doc/1
{ "start_location" : { "lon" : 4.8995, "lat" : 52.3824 } }
GET test-loc
After the post of document 1 I get:
# GET test-loc
{
"test-loc" : {
"aliases" : { },
"mappings" : {
"_default_" : {
"_all" : {
"enabled" : false
}
},
"doc" : {
"_all" : {
"enabled" : false
},
"dynamic_templates" : [
{
"geo_mapping_1" : {
"match" : "*location",
"match_mapping_type" : "string",
"mapping" : {
"type" : "geopoint"
}
}
}
],
"properties" : {
"start_location" : {
"properties" : {
"lat" : {
"type" : "float"
},
"lon" : {
"type" : "float"
}
} } } }
},
. . .
}
}
}
So, apparently, I'm missing something: start_location
property isn't correctly recognized as a geopoint.
I can statically create a geopoint property:
DELETE test-loc
PUT test-loc
{
"mappings": {
"doc": {
"dynamic_templates": [
{
"geo_mapping_1": {
"match_mapping_type": "string",
"match": "*location",
"mapping": {
"type": "geopoint"
}
}
}
],
"properties" : {
"dest_location": {
"type" : "geo_point"
}
}
}
}
}
and the dest_location
is correctly mapped when indexing the following document:
PUT test-loc/doc/2
{
"dest_location" : {
"lon" : 4.8995,
"lat" : 52.3824
}
}
Is there a way to have the complex type correctly recognized and dinamically mapped to the desired property type?