You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ELK search sends an HTTP request with a "Content-Length: nnn" header.
Please describe the actual behavior
ELK search sends an HTTP request with a "Transfer-Encoding: chunked" header.
Transfer-Encoding chunked can be used in a HTTP request but is rarely used and this can cause problems to other tools.
Any steps to reproduce the behavior?
Reproduced in any search request.
The problem is in request.go, in func setBodyHeader(). When called in setBodyJson() or setBodyGzip(), the body is a bytes.Reader, then it must be converted to a bytes.Reader and not a bytes.Buffer to get the ContentLength.
The text was updated successfully, but these errors were encountered:
I've did a few tests, especially with the PR #1441, and the benchmarks are alarming:
$ go test -test.bench=RequestSetBody -run=NONE > old.txt
...
$ go test -test.bench=RequestSetBody -run=NONE > new.txt
...
$ benchcmp old.txt new.txt
benchcmp is deprecated in favor of benchstat: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
benchmark old ns/op new ns/op delta
BenchmarkSearchMatchAll-8 1979627 1041992666 +52535.81%
benchmark old allocs new allocs delta
BenchmarkSearchMatchAll-8 173 4881 +2721.39%
benchmark old bytes new bytes delta
BenchmarkSearchMatchAll-8 96174 1823568 +1796.11%
We have to be very cautious. I'll have another go at this in a later release.
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
ELK search sends an HTTP request with a "Content-Length: nnn" header.
Please describe the actual behavior
ELK search sends an HTTP request with a "Transfer-Encoding: chunked" header.
Transfer-Encoding chunked can be used in a HTTP request but is rarely used and this can cause problems to other tools.
Any steps to reproduce the behavior?
Reproduced in any search request.
The problem is in request.go, in func setBodyHeader(). When called in setBodyJson() or setBodyGzip(), the body is a bytes.Reader, then it must be converted to a bytes.Reader and not a bytes.Buffer to get the ContentLength.
The text was updated successfully, but these errors were encountered: