return this;
}
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyScript == null && keyFieldName == null) {
throw new SearchSourceBuilderException("key_script or key_field must be set on histogram script facet for facet [" + name + "]");
}
if (valueScript == null) {
throw new SearchSourceBuilderException("value_script must be set on histogram script facet for facet [" + name + "]");
}
builder.startObject(name);
builder.startObject(HistogramFacet.TYPE);
if (keyFieldName != null) {