Mapping help for coucbase geo_distance


(John Pettitt) #1

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
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 -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;

add a mapping for the geo_point

curl -XPUT 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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2