Skip to content

update with upstream#1

Open
bbassingthwaite wants to merge 45 commits intobbassingthwaite:masterfrom
olivere:master
Open

update with upstream#1
bbassingthwaite wants to merge 45 commits intobbassingthwaite:masterfrom
olivere:master

Conversation

@bbassingthwaite
Copy link
Copy Markdown
Owner

No description provided.

This commit backports the `SetBasicAuth` option already available in
elastic.v3 into elastic.v2. You can now use `SetBasicAuth("username",
"password")` as an option when setting up a new client (closes #146).

This commit also fixes an issue with the startup healthcheck. We now
use the `http.Client` specified via options in `startupHealthcheck`
instead of setting up our own. The latter would go wrong if the
`http.Client` specified when creating the client is special, e.g. when
it uses HTTP Basic Auth (see #145).
In the normal use case, you create one Client in your application on
startup. You then share this Client throughout your application,
elastic will automatically mark nodes as healthy or dead etc.

However, in restricted environments like App Engine, one cannot create
such a shared client. You must create a new client for every request.
So we cannot afford to keep Goroutines around and must make the
creation of a client as efficient as possible.

So if you now create a new client with the sniffer and healthchecker
disabled (`SetSniff(false)` and `SetHealthcheck(false)`), the
`NewClient` function will skip most of the sanity checks it does on
normal startup. It will also not start any Goroutines.

So to use elastic with restricted environments like App Engine, be sure
to disable sniffer and healthchecker via the options `SetSniff(false)`
and `SetHealthcheck(false)`.
In the normal use case, you create one Client in your application on
startup. You then share this Client throughout your application,
elastic will automatically mark nodes as healthy or dead etc.

However, in restricted environments like App Engine, one cannot create
such a shared client. You must create a new client for every request.
So we cannot afford to keep Goroutines around and must make the
creation of a client as efficient as possible.

So if you now create a new client with the sniffer and healthchecker
disabled (`SetSniff(false)` and `SetHealthcheck(false)`), the
`NewClient` function will skip most of the sanity checks it does on
normal startup. It will also not start any Goroutines.

So to use elastic with restricted environments like App Engine, be sure
to disable sniffer and healthchecker via the options `SetSniff(false)`
and `SetHealthcheck(false)`.
As Elasticsearch 2.0.0 is released, we must update the README.
As Elasticsearch 2.0.0 is released, we update the README accordingly.
This is a backport of [this commit](e310ae7) in elastic.v3.
This commit changes Update in that a 404 response from ES yields an
error from `Update.Do`.

See [PR-153](#153).
The Count service was missing a few properties from the REST API.

Closes #158.
When using HTTP Basic Authentication e.g. with Shield, not only user
requests must be authenticated but also the administrative requests as
well (e.g. sniffing and health checks).
Some environments do not allow to send a HTTP GET request with a body.
The official clients have a SetSendGetBodyAs option for this. It
changes HTTP GET requests with a body to the method specified by
SetSendGetBodyAs.

Example:
client, err := elastic.NewClient(elastic.SetSendGetBodyAs("POST"))
Use `elastic.SetGzip(true)` to enable gzip compression of HTTP
request/response with Elasticsearch. Notice that you need to enable
gzip compression in Elasticsearch first by adding
`http.compression: true` to `elasticsearch.yml` (see
[docs](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/modules-http.html)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants