node-cqrs-eventdenormalizer icon indicating copy to clipboard operation
node-cqrs-eventdenormalizer copied to clipboard

Elasticsearch support

Open alemhnan opened this issue 8 years ago • 8 comments

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.

alemhnan avatar Jan 16 '18 15:01 alemhnan

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)

adrai avatar Jan 16 '18 21:01 adrai

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.

nanov avatar Jan 17 '18 06:01 nanov

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

tommiii avatar Mar 22 '18 12:03 tommiii

Something like this?

nanov avatar Mar 23 '18 07:03 nanov

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?

tommiii avatar Mar 23 '18 13:03 tommiii

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.

nanov avatar Mar 23 '18 13:03 nanov

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

tommiii avatar Mar 23 '18 14:03 tommiii

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?

tommiii avatar Apr 06 '18 09:04 tommiii