# Geo\_point mapping with two fields

**URL:** <https://discuss.elastic.co/t/geo-point-mapping-with-two-fields/14982>\
**Category:** Elasticsearch\
**Created:** [December 21, 2013, 4:14pm UTC](https://discuss.elastic.co/t/geo-point-mapping-with-two-fields/14982 "2013-12-21T16:14:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moh](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@Moh](https://discuss.elastic.co/u/Moh)\
**Post date:** [December 21, 2013, 4:14pm UTC](https://discuss.elastic.co/t/geo-point-mapping-with-two-fields/14982/1 "2013-12-21T16:14:38Z")

</div>

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Karol\_Gwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karol_gwaj/32/1324_2.png) [@Karol\_Gwaj](https://discuss.elastic.co/u/Karol_Gwaj)\
**Post date:** [December 21, 2013, 10:00pm UTC](https://discuss.elastic.co/t/geo-point-mapping-with-two-fields/14982/2 "2013-12-21T22:00:09Z")

</div>

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:

> **[GitHub - SkillPages/elasticsearch-computed-fields: Computed fields plugin for...](https://github.com/SkillPages/elasticsearch-computed-fields)**
>
> Computed fields plugin for ElasticSearch http://www.elasticsearch.org - GitHub - SkillPages/elasticsearch-computed-fields: Computed fields plugin for ElasticSearch http://www.elasticsearch.org

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Moh](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@Moh](https://discuss.elastic.co/u/Moh)\
**Post date:** [December 22, 2013, 2:19pm UTC](https://discuss.elastic.co/t/geo-point-mapping-with-two-fields/14982/3 "2013-12-22T14:19:18Z")

</div>

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:  
> [GitHub - SkillPages/elasticsearch-computed-fields: Computed fields plugin for ElasticSearch http://www.elasticsearch.org](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Moh](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@Moh](https://discuss.elastic.co/u/Moh)\
**Post date:** [December 25, 2013, 9:07am UTC](https://discuss.elastic.co/t/geo-point-mapping-with-two-fields/14982/4 "2013-12-25T09:07:44Z")

</div>

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:  
> [GitHub - SkillPages/elasticsearch-computed-fields: Computed fields plugin for ElasticSearch http://www.elasticsearch.org](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:59am UTC](https://discuss.elastic.co/t/geo-point-mapping-with-two-fields/14982/5 "2017-07-06T01:59:26Z")

</div>


