if (indexMap instanceof Map) {
Builder builder = ImmutableSettings.settingsBuilder();
Object settingsMap = ((Map<String, Object>) indexMap).get("settings");
if (settingsMap != null && settingsMap instanceof Map) {
XContentBuilder settingsBuilder = XContentFactory.contentBuilder(XContentType.JSON);
builder.loadFromSource(settingsBuilder.map((Map<String, Object>) settingsMap).string());
}
Settings settings = builder.build();
CreateIndexRequest cir = new CreateIndexRequest(key, settings);
try {
client.admin().indices().create(cir).actionGet();