public FacetBuilder getFacet() {
Assert.notNull(getName(), "Facet name can't be a null !!!");
Assert.isTrue(StringUtils.isNotBlank(field), "Please select field on which to build the facet !!!");
Assert.isTrue(interval > 0, "Please provide interval as positive value greater them zero !!!");
HistogramFacetBuilder builder = FacetBuilders.histogramFacet(getName());
builder.field(field);
if (timeUnit != null) {
builder.interval(interval, timeUnit);
} else {
builder.interval(interval);
}
return builder;
}