Querying Date Ranges


I’m working on using EventStore for a logging implementation and I am trying to come up with a way to query events within a date range.

I want to be able to provide a start and end date range and then pull all events stored between that range.

I have done some digging but can’t seem to find much guidance.

Does any one have any suggestions on a projection/index which would allow me to do this?


It would be sufficient to be able to resolve an event based on a timestamp then read before or after that event depending on requirements.

I would imagine this would involve indexing the timestamp… would that make sense?

Its easy to do externally … It will be easy to do internally very soon, what time frames are you looking at?


Thanks Greg,

Excuse the noob question, still getting my head around indexing but its starting to make sense

If I wanted to execute this query, would I need to create an adhoc index where I would test the event timestamp against my from and to values, then if it is a match call linkTo to generate the result set?

I simply experimenting with EventStore for implementing this log so no immediate time frame.

I guess i could create an index which would create a stream for each minute of the log. then I could read the relevant streams within my date range and trim off the entries which don’t apply for the seconds/milliseconds in the range.

This however would created a ton of streams… am I missing the point here?

You can’t do this internally, yet. Event store is getting lucene indexing fairly soon. Or you can do thi externally in whatever read model you like.

Ok I understand, thanks

A stream per minute is actually no worries at all (streams are basically free we have a system with 100s of millions)

Thanks, my only concern with this approach would be that I would need to truncate the messages at some point. This is easy enough to do using $maxCount however I will be left with tons of stream with links to missing events. I will wait for the Lucene style queries, sounds promising.