Skip to main content

Administrating MarkLogic Server

Defining Element Range Indexes

To define an element range index for an XML element or JSON property, follow these steps:

  1. Click Databases in the left tree menu. A list of databases appears.

  2. Click your target database.

  3. In the tree menu, under the selected database, click Element Range Indexes.

  4. Click the Add tab.

  5. From the Scalar Type list, select the type of the XML element or JSON property.

  6. Enter the namespace URI of the XML element. Skip this step for a JSON property index.

    Every XML element is associated with a namespace. For the description of the element to be precise, you must specify the namespace of the XML element. The asterisk (*) cannot be used to indicate namespace independence. Leaving the namespace URI field blank specifies the universal unnamed namespace.

  7. Enter the element or JSON property name in the Localname field.

    The value in the Localname field is the name of the XML element to be indexed. If you have more than one element of the same type in the same namespace that you want to index, you can provide a comma-separated list of element names.

  8. If you selected a scalar type of string in Step 5, the Collation field contains a default collation. You can enter a different collation URI or click the Collation Builder button for a wizard that constructs the collation URI for you based on the language and other parameters you enter. For details about collations, see Language Support in MarkLogic Server in the Search Developer’s Guide.

  9. Set the Range Value Positions field to true to increase the speed of searches that use cts:near-query and cts:element-query with this index. However, this setting uses more disk space than the default setting of false.

  10. In the Invalid Values field, choose whether to allow insertion of documents that contain elements or JSON properties on which range index is configured, but the value of those elements cannot be coerced to the index data type. You can choose either ignore or reject. By default, the server rejects insertion of such documents. However, if you choose ignore, these documents can be inserted. This setting does not change the behavior of queries on invalid values after documents are inserted into the database. Performing an operation on an invalid value at query time can still result in an error.

  11. To add more indexes, click More Items and repeat Step 5 - Step 10 for each index as needed.

  12. Scroll to the top or bottom and click OK.

The new element range index or element word lexicon is added to the database. These rules are applied to XML and JSON documents loaded into the specified database from this point on.

Note

If you have reindexing enabled for the database and you specify an element that exists in a document, reindexing will run in the background. When the reindexing is complete, the new index will become available to queries.