Architecting time and dates in first responder app

HI all,

Im building a first responder availability app and I want to use ES as the backend, however I want to make sure its the best fit. Im totally new to Es and one of the reasons im keen to give it a go.

The app consists of 3 types of people: -
team member
team leader

A commander can be a team leader and member, and a leader can be a member, but a member is just a member.

There are around 30 people on the team, on call 24/7 and as everyone is a volunteer they currently book off in hourly segments. So we can see what type of availability we have for any hour. ES seems to handle dates OK, but would it work for hourly blocks and if so, what way would you go about storing each hour the person is either available, not available or delayed availability.

Ideally we would use this to provide a number of views within the app
1 - A list of all people with their availability shown for the day/week/month (im still working on how this will look)
2 - A persons availability singular for a day/week/month

When someone 'books off' I would also like to analyse the time they have booked off for pinch points. This would be when we have very low cover, we would need at least 4 team members, 1 leader and 1 commander available at all times.

Being totally new to es im just looking at some pointers of where to start and if there are any built in types that could help. I guess I would store each hour booked off per user as they add it.

One other thing im not clear about is deleting data too, if a user suddenly becomes available they may wish to delete the time they booked off as plans change, is this kind of live updating/deleting possible too?

We would also like to mine the data in the future to try and spot low availability trends etc, but for now im more concerned with keeping a 'live' view of who is and who isnt available.

I hope my initial question is clear enough.
Thanks in advance.

Hi Paul,

Scheduling applications like yours should be well-catered for with a recent addition to the types of field you can store in elasticsearch. Range types are fields that hold not a single value but a span of a number range (or, in your case, dates and times). It is possible to query these fields efficiently to see if they fall into a particular range using a relation parameter which can be one of WITHIN, CONTAINS, INTERSECTS (default).

e.g. given these time ranges:

   |------- Q -------|
|--A--| |---B--|       |---C---|

Query span Q:

  • intersects range Field A
  • contains range Field B
  • does not intersect C
1 Like

HI Mark,

thanks for the quick response I will look at this, that gives me a better understanding.

Reading around some more it looks like I could potentially use a 'watcher' to highlight and notify when there may be a low number of team members.

To get data in it seems that the best way would be to post the data to logstash via http web hook each time a team member updates the diary.

Any other tips/pointers greatly received whilst im still planning how this will all work. Guess I need to install an ELK stack and start playing now!


Hi Paul,

I don't think you'd need logstash for what you are trying to do. You can post a document using the Index API: . Using a watch to check upcoming schedule availability seems like a pretty reasonable solution to me.

As far as getting started, I recommend reading the definitive guide:

Keep in mind that 5.x features, like range fields ( aren't included in that guide. Don't worry, there is a new one coming!

You also may want to look at Ismael's blog post, A Practical Introduction to Elasticsearch:

You'll find lots of other great posts on our main blog site:

Thanks Balazs,

I don't need to use logstash but as I am going to use this as a learning experience, would there be any harm/detriment to me using logstash? In development the ES server will be in my home office, and I will probably setup logstash on aws, so if my server is unavailable it will at least queue the data if my understanding is clear.

Also I plan to store weather data in ES as well, so will funnel this through LS too for the same reason.


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