Getting started with the API

edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

Getting started with the API

edit

The new typed client can be obtained from the elasticsearch package using the NewTypedClient function. This new API takes the same arguments as the previous one and uses the same transport underneath.

Connection to an Elasticsearch cluster is identical to the existing client, only the API changes:

client, err := elasticsearch.NewTypedClient(elasticsearch.Config{
	// Proper configuration for your {es} cluster.
})

The code is generated from the elasticsearch-specification.