thenativeweb / node-cqrs-eventdenormalizer

Node-cqrs-eventdenormalizer is a node.js module that implements the cqrs pattern. It can be very useful as eventdenormalizer component if you work with (d)ddd, cqrs, domain, host, etc.
http://cqrs.js.org/pages/eventdenormalizer.html
MIT License
38 stars 27 forks source link

Elasticsearch support #70

Open alemhnan opened 6 years ago

alemhnan commented 6 years ago

Apologies for the maybe silly question, is Elasticsearch supported in the denormalization?

I see that I can specify settings for a collection, but I don't see, at least in the docs, where to set up the connection to Elasticsearch.

adrai commented 6 years ago

Never used it, but you can specify the connection settings in the repository options.

The repository options are these: https://github.com/adrai/node-viewmodel/blob/master/README.md (there are 2 different elasticsearch versions)

nanov commented 6 years ago

We use it in production with Elasticsearch 6.1, you should specify your index mappings, settings and ca. in the collection definition and then everything should work pretty much the same.

tommiii commented 6 years ago

I've some doubts about defineCollection and defineViewBuilder for elasticsearch, can you post some example?

nanov commented 6 years ago

Something like this?

tommiii commented 6 years ago

Yes! thanks, now is working. I didn't get how to set the _index and the _type. Looks like that the lib create a string composed by index.collectionName for _index and _type. Is there a method for set them?

nanov commented 6 years ago

Well, the whole thing was written with Elasticsearch 6.X in mind, this means that each index can have only one type and the types will be removed as a whole from Elasticsearch in the future, that is the reason why we left only the index configurable.

tommiii commented 6 years ago

I wasn't aware of this, makes sense. Thank you.

tommiii commented 6 years ago

Hello again, I'm stuck with this issue that happen when I replay all the events:

vm.version = res._version; TypeError: Cannot read property '_version' of undefined

It seems to work fine when I'm working with an small event store. The issue happens when I work with a huge one. Do you know what could be the problem?