// need to merge the _meta part of the mapping mapping before-hand because ES doesn't
// update the _meta column recursively. Instead it is overwritten and therefore partitioned by
// and collection_type information would be lost.
String[] indexNames = getIndexNames(analysis.table(), analysis.partitionName().orNull());
PutMappingRequest request = new PutMappingRequest();
request.indices(indexNames);
request.type(Constants.DEFAULT_MAPPING_TYPE);
IndexMetaData indexMetaData = clusterService.state().getMetaData().getIndices().get(indexNames[0]);
try {
Map mergedMeta = (Map)indexMetaData.getMappings()
.get(Constants.DEFAULT_MAPPING_TYPE)
.getSourceAsMap()
.get("_meta");
if (mergedMeta != null) {
XContentHelper.update(mergedMeta, (Map) mapping.get("_meta"));
mapping.put("_meta", mergedMeta);
}
request.source(mapping);
} catch (IOException e) {
result.setException(e);
}
transportPutMappingAction.execute(request, new ActionListener<PutMappingResponse>() {
@Override