Skip to main content

Using MarkLogic Content Pump (mlcp)

Importing Documents from a Forest into a Database

Use the following procedure to load all the files in a native forest directory and its sub-directories. To load selected files, see Filtering Documents Loaded From a Directory. For more details on the command line options used in this procedure, see Import Command Line Options.

  1. Set -input_file_path to the path to the input forest directory(s). Specify multiple forests using a comma-separated list of paths.

    • To select documents in one or more collections, set -collection_filter to a comma separated list of collection URIs.

    • To select documents in one or more database directories, set -directory_filter to a comma separated list of directory URIs.

    • To select documents by document type, set -type_filter to a comma separated list of document types.

    • To select all documents in the database, leave -collection_filter, -directory_filter, and -type_filter unset.

  2. Set -input_file_type to forest.

  3. Specify the connection information for the destination database using -host, -port, -username, and -password.

  4. Select the files to extract from the input forest. For details, see Filtering Forest Contents. Filtering options can be used together.

  5. If you want to exclude some or all of the document metadata in the forests:

    • Set -copy_collections to false to exclude document collections metadata.

    • Set -copy_quality to false to exclude document quality metadata.

    • Set -copy_metadata to false to exclude key-value metadata.

  6. Set -mode to local (This is the default mode): Your input forests and the destination MarkLogic Server instance must be reachable from the host where you run mlcp.

By default, an imported document has a database URI based on the input file path. You can customize the URI using options. For details, see Controlling Database URIs During Ingestion.

The following example command loads the documents in the forests in /var/opt/MarkLogic/Forests/example:

# Windows users, see Modifying the Example Commands for Windows
$ mlcp.sh import -host localhost -port 8000 -username user \
    -password password -input_file_type forest \
    -input_file_path /var/opt/MarkLogic/Forests/example