public Document withAttributes(DocumentAttribute... attributes) {
        if (this.attributes == null) {
            setAttributes(new java.util.ArrayList<DocumentAttribute>(attributes.length));
        }
        for (DocumentAttribute ele : attributes) {
            this.attributes.add(ele);
        }
        return this;
    }
<p>
Custom attributes to apply to the document. Use the custom attributes to provide additional information for
searching, to provide facets for refining searches, and to provide additional information in the query response.
</p>
<p>
For example, 'DataSourceId' and 'DataSourceSyncJobId' are custom attributes that provide information on the
synchronization of documents running on a data source. Note, 'DataSourceSyncJobId' could be an optional custom
attribute as Amazon Kendra will use the ID of a running sync job.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setAttributes(java.util.Collection)} or {@link #withAttributes(java.util.Collection)} if you want to
override the existing values.
</p>

@param attributes
       Custom attributes to apply to the document. Use the custom attributes to provide additional information
       for searching, to provide facets for refining searches, and to provide additional information in the query
       response.</p>
       <p>
       For example, 'DataSourceId' and 'DataSourceSyncJobId' are custom attributes that provide information on
       the synchronization of documents running on a data source. Note, 'DataSourceSyncJobId' could be an
       optional custom attribute as Amazon Kendra will use the ID of a running sync job.
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-kendra/src/main/java/com/amazonaws/services/kendra/model/Document.java