Skip to content

Commit ab17565

Browse files
committed
add TypedClient usage
1 parent 55da5ff commit ab17565

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/reference/index.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Full documentation is hosted at [GitHub](https://github.com/elastic/go-elasticse
2121

2222
## Usage [_usage]
2323

24+
:::::::{tab-set}
25+
26+
::::::{tab-item} Low-level API
2427
```go
2528
package main
2629

@@ -35,6 +38,29 @@ func main() {
3538
log.Println(es.Info())
3639
}
3740
```
41+
::::::
42+
43+
::::::{tab-item} Fully-typed API
44+
```go
45+
package main
46+
47+
import (
48+
"context"
49+
"log"
50+
51+
"github.com/elastic/go-elasticsearch/v9"
52+
)
53+
54+
func main() {
55+
es, _ := elasticsearch.NewTypedClient(elasticsearch.Config{
56+
Addresses: []string{"http://localhost:9200"},
57+
})
58+
log.Println(es.Info().Do(context.Background()))
59+
}
60+
```
61+
::::::
62+
63+
:::::::
3864

3965
::::{note}
4066
Please have a look at the collection of comprehensive examples in the repository at [https://github.com/elastic/go-elasticsearch/tree/master/_examples](https://github.com/elastic/go-elasticsearch/tree/master/_examples).

0 commit comments

Comments
 (0)