olivere / elastic

Deprecated: Use the official Elasticsearch client for Go at https://github.com/elastic/go-elasticsearch
https://olivere.github.io/elastic/
MIT License
7.42k stars 1.15k forks source link

PerformRequest with options is not always returning a response body #1614

Open Madeyedexter opened 2 years ago

Madeyedexter commented 2 years ago

Please use the following questions as a guideline to help me answer your issue/question without further inquiry. Thank you.

I am using the PerformRequest function to build a proxy endpoint to elasticsearch for administrative purpose. I am passing the following option to the PerformRequest function:

options := elastic.PerformRequestOptions{
        Body:        payload,
        Method:      "GET",
        Path:        "_cat/aliases",
        ContentType: "application/json",
        Params:      ctx.Request.URL.Query(),
    }

Which version of Elastic are you using?

[x] elastic.v7 (for Elasticsearch 7.x) [ ] elastic.v6 (for Elasticsearch 6.x) [ ] elastic.v5 (for Elasticsearch 5.x) [ ] elastic.v3 (for Elasticsearch 2.x) [ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

I am expecting the PerformRequest function to proxy these calls seemlessly

Please describe the actual behavior

PerformRequest is not returning the response body all the time. e.g. if path is /_tasks it return the task lists, however, if the path is /_cat/aliases I am getting the response body as nil. Also the response contains all the headers including the status code as well which is 200.

Any steps to reproduce the behavior?

Use the mentioned payload.