long to = ((Number) mapper.valueFromString(sTo)).longValue();
if (valueField != null) {
return new BoundedValueHistogramFacetCollector(facetName, keyField, valueField, interval, from, to, comparatorType, context);
} else if (valueScript != null) {
return new BoundedValueScriptHistogramFacetCollector(facetName, keyField, scriptLang, valueScript, params, interval, from, to, comparatorType, context);
} else {
return new BoundedCountHistogramFacetCollector(facetName, keyField, interval, from, to, comparatorType, context);
}
}