# Mapping help for coucbase geo\_distance

**URL:** <https://discuss.elastic.co/t/mapping-help-for-coucbase-geo-distance/14206>\
**Category:** Elasticsearch\
**Created:** [October 31, 2013, 10:31pm UTC](https://discuss.elastic.co/t/mapping-help-for-coucbase-geo-distance/14206 "2013-10-31T22:31:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Pettitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_pettitt/32/2013_2.png) [@John\_Pettitt](https://discuss.elastic.co/u/John_Pettitt)\
**Post date:** [October 31, 2013, 10:31pm UTC](https://discuss.elastic.co/t/mapping-help-for-coucbase-geo-distance/14206/1 "2013-10-31T22:31:01Z")

</div>

I'm trying to use elastic search to do geo searches. My data comes via  
the couchbase connecter (and theirin lies the issue). I can make the  
searches work on the sample tweet data if I follow the steps  
here [http://stackoverflow.com/questions/16113439/elasticsearch-geo-distance-filter-with-multiple-locations-in-array-possible](http://stackoverflow.com/questions/16113439/elasticsearch-geo-distance-filter-with-multiple-locations-in-array-possible)  
but something about the couchbase mapping isn't doing it and the doc is  
rather opaque.

Data looks like this

{  
"id": "7719300",  
"hid": 18438,  
"title": "An article title",  
"stamp": "2013-10-10T03:49:00+0000",  
"site": "where it came from",  
"location": [  
{  
"lat": 37.4219444444,  
"lng": -122.084444444  
},  
{  
"lat": 35.458606,  
"lng": -119.355165  
}  
]  
}

There can be multiple locations associated with each record.

The template is:

curl -XPUT [http://localhost:9200/\_template/couchbase](http://localhost:9200/_template/couchbase) -d '{  
"template" : "_",  
"order" : 10,  
"mappings" : {  
"couchbaseCheckpoint" : {  
"\_source" : {  
"includes" : ["doc._"]  
},  
"dynamic\_templates": [  
{  
"store\_no\_index": {  
"match": "_",  
"mapping": {  
"store" : "no",  
"index" : "no",  
"include\_in\_all" : false  
}  
}  
}  
]  
},  
"default" : {  
"\_source" : {  
"includes" : ["meta._"]  
},  
"properties" : {  
"meta" : {  
"type" : "object",  
"include\_in\_all" : false  
}  
}  
}  
}  
}'

Then I create the index.

curl -XPUT [http://localhost:9200/geo;](http://localhost:9200/geo;)

add a mapping for the geo\_point

curl -XPUT [http://localhost:9200/geo/couchbaseDocument/\_mapping](http://localhost:9200/geo/couchbaseDocument/_mapping) -d '{  
"couchbaseDocument": {  
"properties": {  
"doc": {  
"properties": {  
"location": {  
"type": "geo\_point",  
"lat\_lon": true  
}  
}  
}  
}  
}  
}'

and turn on replication.

I can't seem to get a search to work.

curl -XPOST "127.0.0.1:9200/geo/\_search" -d'{  
"query": {  
"filtered" : {  
"query" : {  
"match\_all" : {}  
},  
"filter" : {  
"geo\_distance" : {  
"distance" : "200000km",  
"couchbaseDocument.doc.location" : {  
"lat" : 40.00,  
"lon" : -70.00  
}  
}  
}  
}  
}  
}'

returns no matches I've tried "couchbaseDocument.doc.location",  
"doc.location" and plain "location"

what am I missing?

--  
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).  
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, 2:09am UTC](https://discuss.elastic.co/t/mapping-help-for-coucbase-geo-distance/14206/2 "2017-07-06T02:09:30Z")

</div>


