Applying the Redaction Rules
- Last Updated: April 14, 2026
- 2 minute read
- MarkLogic Server
- Version 12.0
- Documentation
Run the following command from your redact-gs/ directory to export redacted versions of the sample documents. Modify the connection details as needed to match your environment. A collection filter (-collection_filter "gs-samples") is used to select the documents for redaction and export.
$ mlcp.sh export -host localhost -port 8000 \
-username user -password password -mode local \
-collection_filter "gs-samples" \
-output_file_path ./output/ \
-redaction "gs-rules"
Running the export command saves the redacted documents to an output/ sub-directory. You should have the following filesystem hierarch. The “extra” redact-gs sub-directory is created by mlcp because the document URIs are of the form /redact-s/filename.
redact-gs/
output/
redact-gs/
sample1.xml
sample2.json
The following table shows the result of redacting the XML sample document. Notice that the telephone number in the summary element has been partially redacted by the redact-us-phone function. Also, the id element has been completely hidden by the conceal function. The affected parts of the content are highlighted in the table.
Stage |
XML Content |
|---|---|
Original Document |
<personal> <name>Little Bopeep</name> <summary>Seeking lost sheep. Please call 123-456-7890.</summary> <id>12-3456789</id></personal> |
Redacted Result |
<personal>
<name>Little Bopeep</name>
<summary>Seeking lost sheep. Please call ###-###-7890.</summary>
</personal> |
The following table shows the result of redacting the JSON sample document. Notice that the telephone number in the summary property has been partially redacted by the redact-us-phone function. Also, the id property has been completely hidden by the conceal function. The affected parts of the content are highlighted in the table.
Stage |
JSON Content |
|---|---|
Original Document |
{"personal": {
"name": "Jack Sprat",
"summary": "Free nutrition advice! Call (234)567-8901 now!",
"id": "45-6789123"
}} |
Redacted Result |
{"personal": {
"name": "Jack Sprat",
"summary": "Free nutrition advice! Call (###)###-8901 now!"
}} |
To redact documents when copying them between databases rather than exporting them, add the -redaction option to the mlcp copy command line.