MCPcopy
hub / github.com/go-mysql-org/go-mysql-elasticsearch / DoRequest

Method DoRequest

elastic/client.go:188–200  ·  view source on GitHub ↗

DoRequest sends a request with body to ES.

(method string, url string, body *bytes.Buffer)

Source from the content-addressed store, hash-verified

186
187// DoRequest sends a request with body to ES.
188func (c *Client) DoRequest(method string, url string, body *bytes.Buffer) (*http.Response, error) {
189 req, err := http.NewRequest(method, url, body)
190 req.Header.Add("Content-Type", "application/json")
191 if err != nil {
192 return nil, errors.Trace(err)
193 }
194 if len(c.User) > 0 && len(c.Password) > 0 {
195 req.SetBasicAuth(c.User, c.Password)
196 }
197 resp, err := c.c.Do(req)
198
199 return resp, err
200}
201
202// Do sends the request with body to ES.
203func (c *Client) Do(method string, url string, body map[string]interface{}) (*Response, error) {

Callers 3

DoMethod · 0.95
DoBulkMethod · 0.95
GetMappingMethod · 0.95

Calls 1

DoMethod · 0.80

Tested by

no test coverage detected