Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elastic/go-elasticsearch vs olivere/elastic #1240

Closed
harishanumula opened this issue Nov 21, 2019 · 3 comments
Closed

elastic/go-elasticsearch vs olivere/elastic #1240

harishanumula opened this issue Nov 21, 2019 · 3 comments
Assignees
Labels

Comments

@harishanumula
Copy link

I am using Elasticsearch 7.x, I am fairly new to Go, I want to migrate away from python to go and hence would need an Elasticsearch Data Access Layer. I was wondering what the differences were between the official client and this one, and which once is better for the long term.

@olivere olivere self-assigned this Nov 21, 2019
@olivere
Copy link
Owner

olivere commented Nov 21, 2019

Hi! This library was started around 2012 as an MIT-based, free Go driver for Elasticsearch. I've kept it up-to-date to the best of my capabilities. Earlier this year (I think), the good people at Elastic decided to have an official Elasticsearch client. I've been in contact with @karmi and the team at Elastic developing the official client, and I still am from time to time. So there's no bad vibes or tension between the two projects—quite the opposite tbh.

This unofficial library is more of a DSL than the official driver. E.g. it specifies all requests and responses from ES as Go structs, which are not part of the REST API spec as of now. The official client doesn't go as far. You can use a generic approach instead, like sending a map[string]interface{}, or anything serializable to JSON.

I don't know if there will ever be a v8 of olivere/elastic. I'd love to put more time into this project. But as an individual it's hard to keep up with the pace that Elastic, as a company, puts into their product.

Long story short: In the long run, you're probably better off with the official driver. If you're using only a fraction of ES for your project, it can also be a viable approach to skip the driver altogether and simply use the REST API directly.

@olivere olivere closed this as completed Nov 21, 2019
@olivere olivere pinned this issue Nov 21, 2019
@karmi
Copy link

karmi commented Nov 21, 2019

I agree with everything @olivere says above.

I'd be more cautious about this, though:

(...) it can also be a viable approach to skip the driver altogether and simply use the REST API directly (...)

From my own experience, I would advise against this. The elastic/go-elasticsearch client has a small footprint, and provides a reasonable abstraction for calling the Elasticsearch APIs, without you implementing something like myclient.Search() one week, then myclient.Cluster.Health() another week, and so on.

(I've been working on an internal service in Go before writing elastic/go-elasticsearch, and eg. its ability to retry failed requests is something which the "simple wrapper" I wrote didn't provide, and which was super-important for user experience of said service.)

@harishanumula
Copy link
Author

Thank you both of you, your answers help a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants