[[typedapi]]
== Typed API

The goal for this API is to provide a strongly typed Golang API for
{es}.

This was designed with structures and the Golang runtime in mind, following as 
closely as possible the API and its objects.

The first version focuses on the requests and does not yet include NDJSON 
endpoints such as `bulk` or `msearch`. These will be added later on along with 
typed responses and error handling.


[getting-started]
=== Getting started with the API

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 {es} cluster is identical to the existing client, only the API 
changes:

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

The code is generated from the 
https://github.com/elastic/elasticsearch-specification[elasticsearch-specification].

include::conventions/index.asciidoc[]
include::queries.asciidoc[]
include::esql.asciidoc[]
include::examples/index.asciidoc[]