Spatial queries with multiple locations per document

Hi!

I'd like to store documents with multiple geo_point properties in
ElasticSearch. Then I want to query the documents so that only those
documents are returned which have at least one geo_point within a defined
range (lat/lon plus radius). Other non-spatial filters should be applied at
the same time.

My question: Is this possible? How would a document and a query have to
look like, as an example?

As far as I can tell right now I don't need any sorting based on distance.

Thanks!

Marian

--

I never played with that but I think you can create an array of geopoints.

Then simply apply a geo distance filter.

My 2 cents

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 17 oct. 2012 à 09:48, Marian Steinbach marian.steinbach@gmail.com a écrit :

Hi!

I'd like to store documents with multiple geo_point properties in Elasticsearch. Then I want to query the documents so that only those documents are returned which have at least one geo_point within a defined range (lat/lon plus radius). Other non-spatial filters should be applied at the same time.

My question: Is this possible? How would a document and a query have to look like, as an example?

As far as I can tell right now I don't need any sorting based on distance.

Thanks!

Marian

--

--

Thanks for the response!

You're right, why not just try it out? I have set up a test. Right now it
seems as if I couldn't even get the distance range query working with only
one geo_point per document.

I'm using Python and pyes. Here is the code. ElasticSearch - documents with multiple geo_point properties · GitHub

The query should find all three documents and they should be printed out.
But nothing is printed.

Any idea what's wrong?

Marian

Am Mittwoch, 17. Oktober 2012 11:25:13 UTC+2 schrieb David Pilato:

I never played with that but I think you can create an array of geopoints.

Then simply apply a geo distance filter.

My 2 cents

--

Update: I tried using rawes for more comprehensive querying. Changed
https://gist.github.com/3904852 .

I get an empty result.

{
"hits": {
"hits": [],
"total": 0,
"max_score": null
},
"_shards": {
"successful": 5,
"failed": 0,
"total": 5
},
"took": 4,
"timed_out": false
}

--

Seems good to me. Have you tried to run the query with cURL or Es head?

-- Tanguy

Le mercredi 17 octobre 2012 12:51:26 UTC+2, Marian Steinbach a écrit :

Update: I tried using rawes for more comprehensive querying. Changed
ElasticSearch - documents with multiple geo_point properties · GitHub .

I get an empty result.

{
"hits": {
"hits": ,
"total": 0,
"max_score": null
},
"_shards": {
"successful": 5,
"failed": 0,
"total": 5
},
"took": 4,
"timed_out": false
}

--

I've sorted it out. A "es.refresh()" was lacking after the indexing. Gist
is updated.

The test tells me that in fact using multiple geo_points works just fine.
The last query returns two out of three documents.

Thanks for help and encouragement! This is great news for me since it
brings me one step closer to migrating http://offeneskoeln.de/ to
Elasticsearch at some point. Probably I will run some performance test
before though, to make sure that distance filters are something I would
want to offer to all the users, all the time.

Cheers,

Marian

Am Mittwoch, 17. Oktober 2012 13:02:20 UTC+2 schrieb Tanguy:

Seems good to me. Have you tried to run the query with cURL or Es head?

--

Just add something: be careful with lat,lon and [lon,lat] expressions.

As you can see, you have sometimes to give lon before lat. See Elasticsearch Platform — Find real-time answers at scale | Elastic

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 17 oct. 2012 à 13:17, Marian Steinbach marian.steinbach@gmail.com a écrit :

I've sorted it out. A "es.refresh()" was lacking after the indexing. Gist is updated.

The test tells me that in fact using multiple geo_points works just fine. The last query returns two out of three documents.

Thanks for help and encouragement! This is great news for me since it brings me one step closer to migrating http://offeneskoeln.de/ to Elasticsearch at some point. Probably I will run some performance test before though, to make sure that distance filters are something I would want to offer to all the users, all the time.

Cheers,

Marian

Am Mittwoch, 17. Oktober 2012 13:02:20 UTC+2 schrieb Tanguy:
Seems good to me. Have you tried to run the query with cURL or Es head?

--

--

Hi Marian,

welcome onboard - another user in Cologne :slight_smile:

In case you like hints about ES setup and configuration, just ping me

Cheers, Jörg

On Wednesday, October 17, 2012 1:17:49 PM UTC+2, Marian Steinbach wrote:

I've sorted it out. A "es.refresh()" was lacking after the indexing. Gist
is updated.

The test tells me that in fact using multiple geo_points works just fine.
The last query returns two out of three documents.

Thanks for help and encouragement! This is great news for me since it
brings me one step closer to migrating http://offeneskoeln.de/ to
Elasticsearch at some point. Probably I will run some performance test
before though, to make sure that distance filters are something I would
want to offer to all the users, all the time.

Cheers,

Marian

Am Mittwoch, 17. Oktober 2012 13:02:20 UTC+2 schrieb Tanguy:

Seems good to me. Have you tried to run the query with cURL or Es head?

--

Am Mittwoch, 17. Oktober 2012 18:08:25 UTC+2 schrieb Jörg Prante:

Hi Marian,

welcome onboard - another user in Cologne :slight_smile:

In case you like hints about ES setup and configuration, just ping me

Thanks! I'll happily do that. I really pleased with the responsiveness of
the community here on the list. Can't wait to run into the next problems.
:wink:

Marian

--