Loading TOC...


   $model as map:map
) as object-node()


This function is deprecated and will be removed in a future release.
Generate a database configuration artifact from a basic model. This data facilitates creating range indexes and lexicons required for searching instance data.

model A valid basic entity model.

Usage Notes

This function produces JSON database configuration properties that you can use to configure a MarkLogic database. You can use the generated artifact as-is in an ml-gradle project, or customize it slightly for use with the REST Management API.

The configuration data includes a range index definition for each entity type property specified in a es:range-index element in the input model. Similarly, the configuration data includes a word lexicon definition for each property specified in a es:word-lexicon element in the input model. These indexes and lexicon definitions are compatible with the query options you can generate using es:search-options-generate function.

Your application might require additional database configuration. You can use the output of this function as a starting place from which to expand.

See Also


xquery version "1.0-ml";
import module namespace es = "http://marklogic.com/entity-services"
  at "/MarkLogic/entity-services/entity-services.xqy";

es:database-properties-generate( es:model-validate(
  <es:model xmlns:es="http://marklogic.com/entity-services">
      <es:description>ES Examples</es:description>

(: ==> A database configuration artifact similar to the following, as
 :     a JSON object node. You can use it as-is in an ml-gradle project,
 :     or set the values of the "database-name" and "schema-database"
 :     properties and use it with POST /manage/LATEST/databases to create
 :     a new database with this configuration.

{ "database-name": "%%DATABASE%%",
  "schema-database": "%%SCHEMAS_DATABASE%%",
  "path-namespace": [ {
      "prefix": "es",
      "namespace-uri": "http://marklogic.com/entity-services"
  } ],
  "element-word-lexicon": [ {
      "collation": "http://marklogic.com/collation/en",
      "localname": "bio",
      "namespace-uri": ""
  } ],
  "range-path-index": [ {
      "collation": "http://marklogic.com/collation/en",
      "invalid-values": "reject",
      "path-expression": "//es:instance/Person/rating",
      "range-value-positions": false,
      "scalar-type": "float"
  } ],
  "triple-index": true,
  "collection-lexicon": true

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.