@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
if (formatter != null && formatter != ValueFormatter.RAW) {
Text keyTxt = new StringText(formatter.format(key));
if (keyed) {
builder.startObject(keyTxt.string());
} else {
builder.startObject();
}
builder.field(CommonFields.KEY_AS_STRING, keyTxt);
} else {