Skip to main content

Using MarkLogic Content Pump (mlcp)

Installing the Source Documents

When you complete this exercise, the Documents database should contain the following documents. The documents are inserted into a collection named “gs-samples” for easy reference.

  • /redact-gs/sample1.xml

  • /redact-gs/sample2.json

Follow the steps in this procedure to install two sample documents in the Documents database.

  1. Change directory to the data directory you created in Creating a Work Area. You should be in your redact-gs/data directory.

  2. Copy the following text into a file named sample1.xml:

    <personal>
      <name>Little Bopeep</name>
      <summary>Seeking lost sheep. Please call 123-456-7890.</summary>
      <id>12-3456789</id>
    </personal>
  3. Copy the following text into a file name sample2.json:

    {"personal": {
      "name": "Jack Sprat", 
      "summary": "Free nutrition advice! Call (234)567-8901 now!",
      "id": "45-6789123"
    }}
  4. Run the following mlcp command to insert the sample documents into the Documents database. Modify the connection details as needed to match your environment.

    $ mlcp.sh import -host localhost -port 8000 \
        -username user -password password -mode local \
        -input_file_path . \
        -output_uri_replace ".*/redact-gs/data/,'/redact-gs/'" \
        -output_collections "gs-samples"

You can use Query Console to explore the Documents database and confirm the upload.

The use of -output_uri_replace on the import command line replaces the portion of the default URI that is based on the filesystem location with the fixed directory prefix “/rules/gs”. For more details, see Controlling Database URIs During Ingestion.