Geo_point object mapped to text field in elasticsearch

Dear all,

I'm new on elasticseach and on this forum.
I have a mongodb collection that contains objects whish contain geo_point objects.
When I index data from mongodb to elasticsearch using mongo-connector, the mapping and the index are created automaticcally and the geo_point object is mapped to text, so I can't uss it in elasticsearch maps on kibana.

Here is an extract of my source objects called "locations" :

{       "_id" : ObjectId("5e70d49a2a907e356a367cf3"), 
       "organization_id" : "2", 
       "vehicle_id" : "5", 
       "dsn" : "1", 
       "vrn" : "Renault 9808TU161", 
       "fleet_id" : "14", 
       "driver_id" : null, 
       "driver_name" : null, 
       "reference_code" : "520190318142746", 
       "parent_id" : "520190318142746", 
       "**location**" : {
           "type" : "geo_point", 
           "coordinates" : {
               "lat" : 10.6421404, 
               "long" : 34.6872422
           }
       }, 
       "started_at" : ISODate("2019-03-18T14:27:46.000+0000"), 
       "started_in" : {
           "_id" : ObjectI etc.......```

And here is how it is mapped in elasticsearch : 

``` "**location**": {
                 "properties": {
                   "coordinates": {
                     "properties": {
                       "lat": {
                         "type": "float"
                       },
                       "long": {
                         "type": "float"
                       }
                     }
                   },
                   "name": {
                     "type": "text",
                     "fields": {
                       "keyword": {
                         "type": "keyword",
                         "ignore_above": 256
                       }
                     }
                   },
                   "type": {
                     "type": "text",
                     "fields": {
                       "keyword": {
                         "type": "keyword",
                         "ignore_above": 256
                       }
                     }
                   }
                 }
               }

Could you please help, why it is not recognized as geo_point and how can I do ?

Welcome!

You need to create the mapping before indexing documents.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.