Skip to content

Files

Latest commit

e57702f · Aug 9, 2021

History

History
This branch is 256 commits behind elastic/go-elasticsearch:main.

cloudfunction

Example: clusterstatus

This example demonstrates how to use the Elasticsearch Go client with Google Cloud Functions.

Screenshot

Deploy the function with the gcloud command:

$ go mod vendor
$ gcloud functions deploy clusterstatus \
	    --entry-point Health \
	    --runtime go111 \
	    --trigger-http \
	    --memory 128MB \
	    --set-env-vars ELASTICSEARCH_URL=https://...cloud.es.io:9243

Invoke your function over HTTP:

$ curl https://...cloudfunctions.net/clusterstatus

See the function.go file for implementation and the function_test.go file for the example of implementing a mock transport for testing.