[[types]]
==== Types

Requests and responses are relying on a collection of structures generated from the https://github.com/elastic/elasticsearch-specification[elasticsearch-specification] in the `types` package.
Each type comes with json tags.

==== Enums

The {es} API has several instances of enumerations, each has a package within `types/enums`.
An enum is declared as a type and each member of the enum is an exported variable with its value.
The enum types serializes to the relevant API value, for example the `refresh` options which can be found in the Search API:

[source,go]
------------------------------------
refresh.True => "true"
refresh.False => "false"
refresh.Waitfor => "wait_for"
------------------------------------

==== Unions

To capture the expressiveness of the API union fields are represented by a type alias to an interface.