Marvel: reset buffer in HttpExporter
The BytesStreamOutput buffer is not reset when exporting multiple documents. It causes the same marvel doc to be indexed many times and it creates very large bulk requests. Bug introduced in elastic/x-pack@8575fd91c4 Original commit: elastic/x-pack-elasticsearch@adac96677d
This commit is contained in:
parent
0b50bbb5e5
commit
a901aeef86
|
@ -670,10 +670,13 @@ public class HttpExporter extends Exporter {
|
||||||
// because the renderer might close the outputstream (ex: XContentBuilder)
|
// because the renderer might close the outputstream (ex: XContentBuilder)
|
||||||
try (BytesStreamOutput buffer = new BytesStreamOutput()) {
|
try (BytesStreamOutput buffer = new BytesStreamOutput()) {
|
||||||
for (MarvelDoc marvelDoc : docs) {
|
for (MarvelDoc marvelDoc : docs) {
|
||||||
render(marvelDoc, buffer);
|
try {
|
||||||
|
render(marvelDoc, buffer);
|
||||||
// write the result to the connection
|
// write the result to the connection
|
||||||
out.write(buffer.bytes().toBytes());
|
out.write(buffer.bytes().toBytes());
|
||||||
|
} finally {
|
||||||
|
buffer.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue