legrego / homeassistant-elasticsearch

Publish Home-Assistant events to Elasticsearch
https://legrego.github.io/homeassistant-elasticsearch/
MIT License
144 stars 38 forks source link

Use elasticsearchv8 library #277

Open strawgate opened 2 weeks ago

strawgate commented 2 weeks ago

We should consider switching to the elasticsearch v8 library when interacting with elasticsearch v8

legrego commented 1 week ago

Yeah I've considered this as well. I haven't done this yet because: 1) The current ES7 client was meeting all of my needs 2) Adding an additional dependency adds unnecessary bloat to all installations. I admit this is probably negligible. 3) Adding logic to switch between library versions based on cluster version feels like unnecessary complexity.

I'm absolutely in favor of switching when we drop support for v7, but I'm torn on using both libraries in the interim. Other than being more technically correct, what benefits do you see to using the v8 library over the current v7 library? I haven't given the upsides much consideration, so I'm likely missing something.

strawgate commented 1 week ago

It'll make deprecating 7.x easier is the only thing I can think of

strawgate commented 1 week ago

It would be a good excuse for me to implement/play with abstract classes and start shifting all of the legacy/modern code into their own implementations of a base class

strawgate commented 1 week ago

Would it make sense to start consolidating ES interactions (exceptions, bulk, index creation, etc) into es_gateway, with the functions in es_gateway being a thin wrapper around the underlying Elasticsearch libraries, perhaps using an ABC so we can have both es7 and es8 (and eventually es9) implementations?