olivere / elastic

Deprecated: Use the official Elasticsearch client for Go at https://github.com/elastic/go-elasticsearch
https://olivere.github.io/elastic/
MIT License
7.39k stars 1.15k forks source link

Does olivere support "REST API compatibility" #1652

Open jshenpdp opened 1 year ago

jshenpdp commented 1 year ago

Does olivere support the concept of REST API compatibility? Although it is a good practice not to make cross-communication between client and server which are of different versions, sometimes in practice, we encounter the need to use the same client to ping elasticsearch servers of different versions.

As mentioned in the page, in order to request REST API compatibility, the client needs to specify in the header about Accept and "Content-Types":

Accept: "application/vnd.elasticsearch+json;compatible-with=7"
Content-Type: "application/vnd.elasticsearch+json;compatible-with=7"

This is not a bug, but a question about current or potential future feature of the library. Does olivere already support this?

Which version of Elastic are you using?

[x] elastic.v7 (for Elasticsearch 7.x) [x] elastic.v6 (for Elasticsearch 6.x) [ ] elastic.v5 (for Elasticsearch 5.x) [ ] elastic.v3 (for Elasticsearch 2.x) [ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

elastic v7 is able to make requests to both Elasticsearch 7 and 8 servers with the same endpoint, expecting the same behavior.

Please describe the actual behavior

NA, as this issue is a question rather than a bug.

Any steps to reproduce the behavior?

NA, as this issue is a question rather than a bug.

olivere commented 1 year ago

Yeah, we might add this to the library. Notice however that with ES 8.x, you need to use the official Go client.

bplies-ATX commented 1 year ago

Been using this transitively via https://github.com/phillbaker/terraform-provider-elasticsearch Terraform provider. This has worked well up through Elastic 8.5.3. We just upgraded to 8.6.0 and things finally fell apart. @olivere how did you find out that there is a need to use the official Go client?

Elastic is trying to offer their own Terraform provider now so maybe we'll have to switch.

1340691923 commented 1 year ago

@olivere Why do I use the official library when it's so difficult to use