|
| 1 | +# 8.4.0-alpha.1 |
| 2 | + |
| 3 | +This prerelease introduces a new typed API generated from the [elasticsearch-specification](https://github.com/elastic/elasticsearch-specification). This generation from the common specification allows us to provide a complete API which uses an exhaustive hierarchy of types reflecting the possibilities given by Elasticsearch. |
| 4 | + |
| 5 | +This new API is the next iteration of the Go client for Elasticsearch, it now lives alongside the existing API, it is in `alpha` state and will gain features over time and releases. |
| 6 | + |
| 7 | +## What's new |
| 8 | + |
| 9 | +The `TypedClient` is built around a fluent builder for easier request creation and a collection of structures and helpers that mimics as closely as possible the Elasticsearch JSON API. |
| 10 | + |
| 11 | +As a first example, here is a search request: |
| 12 | +```go |
| 13 | +cfg := elasticsearch.Config{ |
| 14 | + // Define your configuration |
| 15 | +} |
| 16 | +es, _ := elasticsearch.NewTypedClient(cfg) |
| 17 | +res, err := es.Search(). |
| 18 | + Index("index_name"). |
| 19 | + Request(&search.Request{ |
| 20 | + Query: &types.QueryContainer{ |
| 21 | + Match: map[types.Field]types.MatchQuery{ |
| 22 | + "name": {Query: "Foo"}, |
| 23 | + }, |
| 24 | + }, |
| 25 | + }, |
| 26 | + ).Do(context.Background()) |
| 27 | +``` |
| 28 | + |
| 29 | +The `Request` uses the structures found in the `typedapi/types` package which will lead you along the possibilities. A builder for each structure that allows easier access and declaration is also provided. |
| 30 | + |
| 31 | +More on the specifics and a few examples of standard use-cases can be found in the [TypedAPI section of the documentation](https://www.elastic.co/guide/en/elasticsearch/client/go-api/master/typedapi.html). |
| 32 | + |
| 33 | +## Limitations |
| 34 | + |
| 35 | +While most of the endpoints are covered, a few points are still being worked on and will be part of future releases: |
| 36 | + |
| 37 | +* NDJSON endpoints: `bulk`, `msearch`, `msearch_template`, `ML.post_data`, `find_structure`, to name a few. |
| 38 | +* Response and Errors structures with deserialization. |
| 39 | + |
| 40 | +## Transport & config |
| 41 | + |
| 42 | +While being different, the new API uses all the existing layers that were built so far, `elastic-transport-go` remains the preferred transport and all your configuration and credentials applies, same as before. |
| 43 | + |
| 44 | +## Feedback |
| 45 | + |
| 46 | +Feedback is very welcome, play with it, use it, let us know what you think! |
| 47 | + |
1 | 48 | # 8.3.0 |
2 | 49 |
|
3 | 50 | ## API |
|
0 commit comments