Querying geolocated events with a duration in time

Hello,

I'm starting a new project and I thought that Elasticsearch could work for my use case but I have a problem I couldn't find the way to solve it and I hope anyone can shed some light on it.

I want to store physical world event (for example concerts or conferences) into Elasticsearch. Each event has a geolocation, a starting time and a duration (or finishing time).

Once I have all the information in Elasticsearch, I want to use "geo_distance" queries for identifying events close to me at this exact moment.

The problem I'm having is that if there is a concert the 20th February 2020 from 20:00 to 22:00 and I search for "events close to me at 21:00", this concert is not going to listed in the results because the document indexed into Elasticsearch has a timestamp pointing to 20:00, so Elastic doesn't include the concert in the results of the query.

Bearing in mind that I have full control over the documents I index, which is the best way to do it (indexing documents) to be able to retrieve not only the events with the same timestamp of the query but also those that are happening at that moment?

Thanks in advance,

J.

You may want to check out the date_range datatype.

Another solution would probably be just to search for events, that started before 9pm and are finished after 9pm (this highly depends on your data, maybe a multi day conference should not pop up there).

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.