Map<String, Object> mappings = (Map<String, Object>) source.get("mappings");
for (Map.Entry<String, Object> entry : mappings.entrySet()) {
if (!(entry.getValue() instanceof Map)) {
throw new ElasticSearchIllegalArgumentException("Malformed mappings section for type [" + entry.getKey() + "], should include an inner object describing the mapping");
}
putRequest.mapping(entry.getKey(), (Map<String, Object>) entry.getValue());
}
}
} catch (Exception e) {
try {
channel.sendResponse(new XContentThrowableRestResponse(request, e));