Number of filter matches in array field

I have a set of documents, each with an array of geo_points:

{
name: "Test Record",
locations: [
{
lat: 55.866638
lon: -4.289562
},
{
lat: 50.716633
lon: -1.878344
},
{
lat: 51.53587
lon: 0.696672
},
{
lat: 52.479473
lon: -1.909198
},
{
lat: 51.490692
lon: -0.224432
}
]
}

When using a geo_distance filter, is there a way to return, for each
document, the number of locations that matched the filter (I.E. were within
the search radius)?

Thanks!

--

I am wondering if you are not looking for Geo Distance Facets [1], do you?

[1]
http://www.elasticsearch.org/guide/reference/api/search/facets/geo-distance-facet.html

HTH
David

Le 3 décembre 2012 à 17:25, Doug Fitzmaurice doug.fitzmaurice@ents24.com a
écrit :

I have a set of documents, each with an array of geo_points:

{
name : "Test Record" ,
locations : [
{
lat : 55.866638
lon : - 4.289562
},
{
lat : 50.716633
lon : - 1.878344
},
{
lat : 51.53587
lon : 0.696672
},
{
lat : 52.479473
lon : - 1.909198
},
{
lat : 51.490692
lon : - 0.224432
}
]
}

When using a geo_distance filter, is there a way to return, for each
document, the number of locations that matched the filter (I.E. were within
the search radius)?

Thanks!

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

I've had a go at using the geo_distance facet, but as far as I can tell it
returns the total number of documents that match each range, whereas I
would like the number of locations that match per-document.

As an example, if I queried with a geo_distance filter of "lat: 55, lon: -4" against
the above document, I would expect one of the location entries to match, so
the document would be returned, but I would like to know how many of the
location entries in that document match (even if the answer is only 1).

On Monday, December 3, 2012 4:51:53 PM UTC, David Pilato wrote:

I am wondering if you are not looking for Geo Distance Facets [1], do
you?

[1]
http://www.elasticsearch.org/guide/reference/api/search/facets/geo-distance-facet.html

HTH
David

Le 3 décembre 2012 à 17:25, Doug Fitzmaurice <doug.fit...@ents24.com<javascript:>>
a écrit :

I have a set of documents, each with an array of geo_points:

{
name : "Test Record" ,
locations : [
{
lat : 55.866638
lon : - 4.289562
},
{
lat : 50.716633
lon : - 1.878344
},
{
lat : 51.53587
lon : 0.696672
},
{
lat : 52.479473
lon : - 1.909198
},
{
lat : 51.490692
lon : - 0.224432
}
]
}

When using a geo_distance filter, is there a way to return, for each
document, the number of locations that matched the filter (I.E. were within
the search radius)?

Thanks!

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

Could this be done using either highlighting or nested documents?

I had a go at using highlighting, but I can't find any documentation on
using it with a geo_distance filter, and I haven't been able to make it
work.

Nested / child documents could also work, but most queries that operate on
them seem to be focused on returning parents where any child matches a
parameter, whereas I want to return the parent, and those child documents
that caused the match.

On Monday, December 3, 2012 4:59:00 PM UTC, Doug Fitzmaurice wrote:

I've had a go at using the geo_distance facet, but as far as I can tell it
returns the total number of documents that match each range, whereas I
would like the number of locations that match per-document.

As an example, if I queried with a geo_distance filter of "lat: 55, lon:
-4" against the above document, I would expect one of the location
entries to match, so the document would be returned, but I would like to
know how many of the location entries in that document match (even if
the answer is only 1).

On Monday, December 3, 2012 4:51:53 PM UTC, David Pilato wrote:

I am wondering if you are not looking for Geo Distance Facets [1], do
you?

[1]
http://www.elasticsearch.org/guide/reference/api/search/facets/geo-distance-facet.html

HTH
David

Le 3 décembre 2012 à 17:25, Doug Fitzmaurice doug.fit...@ents24.com a
écrit :

I have a set of documents, each with an array of geo_points:

{
name : "Test Record" ,
locations : [
{
lat : 55.866638
lon : - 4.289562
},
{
lat : 50.716633
lon : - 1.878344
},
{
lat : 51.53587
lon : 0.696672
},
{
lat : 52.479473
lon : - 1.909198
},
{
lat : 51.490692
lon : - 0.224432
}
]
}

When using a geo_distance filter, is there a way to return, for each
document, the number of locations that matched the filter (I.E. were within
the search radius)?

Thanks!

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--