@Override
  public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
    builder.startObject(name);
    builder.field("type", CONTENT_TYPE);
    builder.field("path", pathType.name().toLowerCase());

    builder.startObject("fields");
    contentMapper.toXContent(builder, params);
    authorMapper.toXContent(builder, params);
    titleMapper.toXContent(builder, params);
    dateMapper.toXContent(builder, params);
    keywordsMapper.toXContent(builder, params);
    builder.endObject();

    builder.endObject();
    return builder;
  }