log.warn(String.format("No mapping found [%s] and no schema found; letting Elasticsearch perform auto-mapping...", settings.getResourceWrite()));
}
else {
log.info(String.format("No mapping found [%s], creating one based on given schema", settings.getResourceWrite()));
ContentBuilder builder = ContentBuilder.generate(schemaWriter).value(schema).flush();
BytesArray content = ((FastByteArrayOutputStream) builder.content()).bytes();
builder.close();
client.putMapping(content);
if (log.isDebugEnabled()) {
log.debug(String.format("Creating ES mapping [%s] from schema [%s]", content.toString(), schema));
}
}
}
client.close();
}