We have some offers with multiple adresse (geo_point), and we wan't to
search all adress around x km...
Actualy, we retrieve correct offers but with all geo_point, and no just
corresponding geo_point.
Is it possible with nested object, without use parent/child ?
The other solution is to create a type localisations, with all adress and
some offers informations and make our query in this type, is it the better
solution ?
thanks
Jean
our tests :
DELETE /test/
POST /test/
{
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"offres" : {
"_source" : { "enabled" : true },
"properties" : {
"title" : { "type" : "string" },
"locations" : {
"type" : "nested",
"include_in_parent": true,
"properties": {
"position": {
"type": "geo_point",
"store": true
},
"addresse": {
"type": "string"
}
}
}
}
}
}
}
POST /test/offres/1
{
"title" : "offre 1",
"locations" : {
"addresse" : "Grand-Rue 33, 1302 Vufflens-la-Ville",
"position" : {"lat" : 46.575851, "lon" : 6.539845}
}
}
POST /test/offres/2
{
"title" : "offre 2",
"locations" : [
{
"addresse" : "La Tuilière 18, 1163 Etoy",
"position" : { "lat" : 46.476884, "lon" : 6.423888}
},
{
"addresse" : "Rue de la Poste 9A, 1302 Vufflens-la-Ville",
"position" : { "lat" : 46.577235, "lon" : 6.539905}
}
]
}
GET /test/offres/_search
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "34m",
"locations.position": {
"lat": 46.5769427,
"lon": 6.539985799999999
}
}
}
}
},
"sort": {
"_geo_distance": {
"locations.position": {
"lat": 46.5769427,
"lon": 6.539985799999999
},
"order": "asc",
"unit": "km"
}
},
"size": 20
}
--
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/691c3635-f66a-49f5-bcc6-46714408dd40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.