MCPcopy
hub / github.com/elastic/go-elasticsearch / Example

Method Example

_examples/extension/main.go:55–64  ·  view source on GitHub ↗

Example calls a custom REST API, "/_cat/example".

()

Source from the content-addressed store, hash-verified

53
54// Example calls a custom REST API, "/_cat/example".
55func (c *ExtendedAPI) Example() (*esapi.Response, error) {
56 req, _ := http.NewRequest("GET", "/_cat/example", nil) // errcheck exclude
57
58 res, err := c.Perform(req)
59 if err != nil {
60 return nil, err
61 }
62
63 return &esapi.Response{StatusCode: res.StatusCode, Body: res.Body, Header: res.Header}, nil
64}
65
66func main() {
67 log.SetFlags(0)

Callers 1

mainFunction · 0.80

Calls 1

PerformMethod · 0.65

Tested by

no test coverage detected