Geo_point mapping with two fields


(Moh) #1

Hi,

I'm writing a river from MySQL to ElasticSearch with JDBC River.

I'm facing the problem which is to map two fields from a table (lat :
double, lon : double) to one elasticseach property geo_point.

I trying this but it does not work.

      "properties": {
                "_id": {
                    "type": "long",
                    "store": "yes"
                },
                "location": { 
                    "type": "geo_point", 
                    "lat_lon": true,
                    "fields": {
                        "lon": {
                            "type": "double",
                            "store": "yes"
                        },                    
                        "lat": {
                            "type": "double",
                            "store": "yes"
                        }
                    }
                }
            }

How can I solve this problem.

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/10f81de3-b539-4a2c-8d2f-ae7af5e3acb6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Karol Gwaj) #2

to work with the mapping above your indexed document will have to look
something like that:
{
"id" : 1234,
*"location" : *

  • {*
  •    "lat" : 53.1,*
    
  •    "lon" : -6.1*
    
  • }*
    }

if for some reason your document have to have flat structure, then you can
try computed fields plugin:

Cheers,

On Saturday, December 21, 2013 4:14:38 PM UTC, Moh wrote:

Hi,

I'm writing a river from MySQL to ElasticSearch with JDBC River.

I'm facing the problem which is to map two fields from a table (lat :
double, lon : double) to one elasticseach property geo_point.

I trying this but it does not work.

      "properties": {
                "_id": {
                    "type": "long",
                    "store": "yes"
                },
                "location": { 
                    "type": "geo_point", 
                    "lat_lon": true,
                    "fields": {
                        "lon": {
                            "type": "double",
                            "store": "yes"
                        },                    
                        "lat": {
                            "type": "double",
                            "store": "yes"
                        }
                    }
                }
            }

How can I solve this problem.

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/29c451fb-6da1-44f8-8115-efebf2e9e55a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Moh) #3

so it's not a native fonction in ES.
Thanks for the plugin.
Regards

Le samedi 21 décembre 2013 23:00:09 UTC+1, Karol Gwaj a écrit :

to work with the mapping above your indexed document will have to look
something like that:
{
"id" : 1234,
*"location" : *

  • {*
  •    "lat" : 53.1,*
    
  •    "lon" : -6.1*
    
  • }*
    }

if for some reason your document have to have flat structure, then you can
try computed fields plugin:
https://github.com/SkillPages/elasticsearch-computed-fields

Cheers,

On Saturday, December 21, 2013 4:14:38 PM UTC, Moh wrote:

Hi,

I'm writing a river from MySQL to ElasticSearch with JDBC River.

I'm facing the problem which is to map two fields from a table (lat :
double, lon : double) to one elasticseach property geo_point.

I trying this but it does not work.

      "properties": {
                "_id": {
                    "type": "long",
                    "store": "yes"
                },
                "location": { 
                    "type": "geo_point", 
                    "lat_lon": true,
                    "fields": {
                        "lon": {
                            "type": "double",
                            "store": "yes"
                        },                    
                        "lat": {
                            "type": "double",
                            "store": "yes"
                        }
                    }
                }
            }

How can I solve this problem.

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/dd8e0288-6deb-449b-a4da-e26a2549284a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Moh) #4

ok thx for plugin !

Le samedi 21 décembre 2013 23:00:09 UTC+1, Karol Gwaj a écrit :

to work with the mapping above your indexed document will have to look
something like that:
{
"id" : 1234,
*"location" : *

  • {*
  •    "lat" : 53.1,*
    
  •    "lon" : -6.1*
    
  • }*
    }

if for some reason your document have to have flat structure, then you can
try computed fields plugin:
https://github.com/SkillPages/elasticsearch-computed-fields

Cheers,

On Saturday, December 21, 2013 4:14:38 PM UTC, Moh wrote:

Hi,

I'm writing a river from MySQL to ElasticSearch with JDBC River.

I'm facing the problem which is to map two fields from a table (lat :
double, lon : double) to one elasticseach property geo_point.

I trying this but it does not work.

      "properties": {
                "_id": {
                    "type": "long",
                    "store": "yes"
                },
                "location": { 
                    "type": "geo_point", 
                    "lat_lon": true,
                    "fields": {
                        "lon": {
                            "type": "double",
                            "store": "yes"
                        },                    
                        "lat": {
                            "type": "double",
                            "store": "yes"
                        }
                    }
                }
            }

How can I solve this problem.

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7614e014-84be-4f8a-a562-3871a9ff111f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5