try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
builder.map(searchSource);
return searchSource(builder);
} catch (IOException e) {
throw new ElasticSearchGenerationException("Failed to generate [" + searchSource + "]", e);
}
}