Searching for geo_circles as geo_shapes

This commithttps://github.com/elasticsearch/elasticsearch/commit/0c2d12bda34fbbe0ffd3cef5140f5d5a3919b080adds support for indexing circles as geo_shapes, which is something I'd
like to do (rather than approximating circles with polygons).

However, searching for intersection between a point and a circle (is this
point in a circle) doesn't seem to work. Checking if a point is in a
polygon can be done like this:

POST polygons/_search
{
"size" : 1000000,
"query" : {
"terms" : {
"_id" : [ "GKN_32UnRiylOsYwyltX4g" ]
}
},
"post_filter" : {
"geo_shape" : {
"vertices" : {
"shape" : {
"type" : "point",
"coordinates" : [ 150, -30 ]
},
"relation" : "intersects"
}
}
}
}

So that will check if the point (150, -30) is in the polygon with the id
GKN.. But if the "polygon" is instead a circle, I don't get any hits
(regardless of how big I make the circle). Since the search is for a
geo_shape and got a geo_circle and a geo_polygon are geo_shapes, it seems
like this should work.

What am I missing?

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/26c71961-0dde-4416-80ea-2687a85a5b19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

It's my impression, and indeed experience, that searching a distance from a
geo_point means that the distance is a radius, and therefore the search is
a circular shape. No need for an explicit shape: A circle is nothing more
than a distance from a point.

Regards,
Brian

--
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/401fe81d-9f39-4e30-ac98-1f6d4d2b6e91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

So here's my use case: say that you have 50 points, with different radii.

A new point is added and I want to check, is this point within any of the
other 50 circles. I can't do just a search for a distance, because there's
no one distance to search for. Does that make sense?

On Tuesday, 1 April 2014 04:46:17 UTC+11, InquiringMind wrote:

It's my impression, and indeed experience, that searching a distance from
a geo_point means that the distance is a radius, and therefore the search
is a circular shape. No need for an explicit shape: A circle is nothing
more than a distance from a point.

Regards,
Brian

--
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/2a24cfc4-6946-4ff7-a5b6-cb6078e080f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hey,

can you create a complete example, including mapping, indexing and
searching, so one can reproduce locally?

--Alex

On Wed, Apr 9, 2014 at 12:39 PM, Viktor Nordling
viktor.nordling@gmail.comwrote:

So here's my use case: say that you have 50 points, with different radii.

A new point is added and I want to check, is this point within any of the
other 50 circles. I can't do just a search for a distance, because there's
no one distance to search for. Does that make sense?

On Tuesday, 1 April 2014 04:46:17 UTC+11, InquiringMind wrote:

It's my impression, and indeed experience, that searching a distance from
a geo_point means that the distance is a radius, and therefore the search
is a circular shape. No need for an explicit shape: A circle is nothing
more than a distance from a point.

Regards,
Brian

--
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/2a24cfc4-6946-4ff7-a5b6-cb6078e080f7%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/2a24cfc4-6946-4ff7-a5b6-cb6078e080f7%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAGCwEM_ehbfeQdxkxWC-dhMmp903kdBVE0DDZyH%3DiH5%2BNVGtLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

I am having the same problem with the search all assets that have a circle that intersects a point. Did somebody have a solution to this?

I have a bit of code in my geogeometry project that converts circles to
polygons with whatever number of segments you wish:
https://github.com/jillesvangurp/geogeometry/blob/master/src/main/java/com/jillesvangurp/geo/GeoGeometry.java.
A few dozen gives you a really nice approximation of a circle typically.

Look for the circle2polygon method. It's in Java but it's quite easy to
convert it to other languages since it is a simple static method. Using
that you should be able to use the geo_shape query to do intersects queries
on es. Would actually be nice if they added support for circles using
something like this. I guess the main issue is figuring out how many
segments you need on the circle.

Jilles

On Thursday, July 10, 2014 10:51:03 AM UTC+2, Silviu Rosu wrote:

I am having the same problem with the search all assets that have a circle
that intersects a point. Did somebody have a solution to this?

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Searching-for-geo-circles-as-geo-shapes-tp4053167p4059531.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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/7daed3d6-5562-4ba5-b741-4cd17d0c27ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

@Silviu, sorry I never got around to submitting a "complete example,
including mapping, indexing and searching" and instead worked around it
with polygons. If you have the energy it would be great to get that example
submitted.

Cheers,
Viktor

On Friday, 11 July 2014 00:38:12 UTC+10, Jilles van Gurp wrote:

I have a bit of code in my geogeometry project that converts circles to
polygons with whatever number of segments you wish:
https://github.com/jillesvangurp/geogeometry/blob/master/src/main/java/com/jillesvangurp/geo/GeoGeometry.java.
A few dozen gives you a really nice approximation of a circle typically.

Look for the circle2polygon method. It's in Java but it's quite easy to
convert it to other languages since it is a simple static method. Using
that you should be able to use the geo_shape query to do intersects queries
on es. Would actually be nice if they added support for circles using
something like this. I guess the main issue is figuring out how many
segments you need on the circle.

Jilles

On Thursday, July 10, 2014 10:51:03 AM UTC+2, Silviu Rosu wrote:

I am having the same problem with the search all assets that have a
circle
that intersects a point. Did somebody have a solution to this?

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Searching-for-geo-circles-as-geo-shapes-tp4053167p4059531.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
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/e0ae41fa-a84f-414b-818f-995531d2bf61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.