Elasticsearch 5: Close content builder
This commit wraps the usage of a content builder in a try-with-resources
block to ensure that it is correctly closed.
@@ -150,8 +150,7 @@ public class ElasticsearchClient extends DB {
@Override
public Status insert(String table, String key, Map<String, ByteIterator> values) {
- try {
- final XContentBuilder doc = jsonBuilder();
+ try (XContentBuilder doc = jsonBuilder()) {
doc.startObject();
for (final Entry<String, String> entry : StringByteIterator.getStringMap(values).entrySet()) {
