Auditing

Learn about Spring Data Elasticsearch's auditing feature.

Auditing in Spring Data Elasticsearch involves automatically tracking and managing metadata changes in indexed documents. It captures details like creation, modification timestamps, and user identifiers, enhancing data governance, traceability, and compliance. Auditing enables robust record-keeping and historical analysis in Elasticsearch-based applications.

Auditing metadata in document classes

First, let’s add a few properties in the POJOs that map the auditing metadata field in the database.

The Book document

Let’s add properties like createdBy, dateCreated, updatedBy, and dateUpdated to the Book class. The underlying Spring Data Elasticsearch will take care of updating the datastore with the corresponding fields in the book document. ...