# Elasticsearch as eventstore for CQRS

**URL:** <https://discuss.elastic.co/t/elasticsearch-as-eventstore-for-cqrs/13252>\
**Category:** Elasticsearch\
**Created:** [August 19, 2013, 8:50am UTC](https://discuss.elastic.co/t/elasticsearch-as-eventstore-for-cqrs/13252 "2013-08-19T08:50:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [August 19, 2013, 1:49pm UTC](https://discuss.elastic.co/t/elasticsearch-as-eventstore-for-cqrs/13252/2 "2013-08-19T13:49:36Z")

</div>

Elasticsearch is great for storing and handling events, but more in a way  
that Cube does - [Cube](http://square.github.io/cube/). Basically, making sense of  
events, analysis etc.

With CQRS you need to have a way to construct objects out of events, aka  
projections or snaphots. You write events and query objects that are formed  
out of it. There is no such clear separation between read and write stores  
in Elasticsearch. You could, obviously, have some sort of a cron job that  
continously runs and creates an object snapshot out of the events and  
stores it under a different type or index, but that feels quite a bit  
artificial.

There may be a way to achieve proper snapshotting via a plugin but I  
haven't thought about that previously. I'll be happy to look into it when I  
got some time.

On Mon, Aug 19, 2013 at 4:50 AM, Roger Villars [villars.roger@gmail.com](mailto:villars.roger@gmail.com)wrote:

> Hi.
> 
> Recently I came around across an interesting new application design  
> pattern called CQRS (see [CQRS](http://martinfowler.com/bliki/CQRS.html)).  
> CQRS manages the application state as stream of events (event sourcing).
> 
> Axon Framework ([http://www.axonframework.org/](http://www.axonframework.org/)) is one popular  
> implementation of a CQRS framework. With Axon, events can be stored  
> on the filessystem, a database or... MongoDB.
> 
> As soon a I read this I had an idea. MongoDB is a document oriented  
> database. elasticsearch is also document oriented. Both frameworks  
> act very similar on an technical level (of course the terminology is  
> completely different).
> 
> So my questions now:
> 
> Could elasticsearch be used an eventstore for axon (or generally for CQRS)?  
> Is there anyone out there that has already tried that. Any practical  
> experience?  
> Are there any technical obstacles in elasticsearch that would prevent  
> using it as eventstore?
> 
> Thanks for your feedback  
> Roger
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

_[View the full topic](https://discuss.elastic.co/t/elasticsearch-as-eventstore-for-cqrs/13252)._
