Searching for a stream in EventStore

Event stores are designed to support retrieval exclusively by the key of the entity. To support retrieval by other attributes, data is indexed in an eventually consistent, de-normalized fashion specifically for each use case and in a separate place. So the event-store only stores events and to support querying of any sort indexed projections are utilized. These are sort of like persistent views in a relational database but they can be stored in a simple key-value store. Together, an event-store and a projection store constitute part of the infrastructure behind a CQRS + Event Sourcing architecture. Take a look here and the rest of that blog for more on this subject.


It's likely you're trying to use the event store incorrectly. An event store is built only for saving and reading streams of committed events for rebuilding event-sourced aggregates. Implementations provide headers for conveniently implementing infrastructure concerns, such as request/response correlation IDs, auditing, security, and the like. If you find yourself putting business attributes in there -- like a customer id -- then you may need to instead build a read model as suggested by @eulerfx.

If it's an ID you're looking for, then you should consider making CustomerID the actual event stream ID for that customer. Loading a particular customer by its ID is exactly what you'd expect an event store to do.


EventStore now has projections which can do what you are looking for. Please see this blog for details

http://geteventstore.com/blog/20130227/projections-6-an-indexing-use-case/