homeassistant-elasticsearch icon indicating copy to clipboard operation
homeassistant-elasticsearch copied to clipboard

Use elasticsearchv8 library

Open strawgate opened this issue 1 year ago • 4 comments

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

strawgate avatar Apr 19 '24 19:04 strawgate

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.

legrego avatar Apr 22 '24 12:04 legrego

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

strawgate avatar Apr 22 '24 12:04 strawgate

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 avatar Apr 22 '24 15:04 strawgate

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?

strawgate avatar Apr 25 '24 19:04 strawgate