You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MarkLogic 9.2通过Management API设置元数据字段报错,求解决方案

How to Set Metadata Fields via Management API in MarkLogic 9.2

Let's break down what's happening here and fix your issue:

Root Cause of the 500 Error

The error XDMP-UNDFUN: Undefined function Q{http://marklogic.com/xdmp/admin}database-set-field-metadata() occurs because MarkLogic 9.2 does not include the admin:database-set-field-metadata() function. This function was introduced in MarkLogic 10, so trying to trigger it via the Management API in 9.2 will fail outright.

Your request uses the metadata property, which is a MarkLogic 10+ feature. The schema you referenced likely belongs to newer versions (hence the requirement for an empty string), but this detail is irrelevant because the underlying administrative function doesn't exist in 9.2.

Correct Approach for MarkLogic 9.2

In MarkLogic 9, metadata fields are configured using the metadata-kind property instead of metadata. You need to specify exactly which type of system metadata the field should map to (e.g., document URIs, collections, permissions).

Here's the corrected PUT request to create a metadata field in 9.2:

PUT /manage/v2/databases/mydb/properties
Accept: application/json
Content-Type: application/json

Request body (replace "uri" with your desired metadata type):

{
  "field": [
    {
      "field-name": "foobar",
      "metadata-kind": "uri"
    }
  ]
}

Valid values for metadata-kind in MarkLogic 9 include:

  • uri: Maps to document URIs
  • collection: Maps to document collections
  • permissions: Maps to document permissions
  • quality: Maps to document quality scores
  • properties: Maps to document properties

Additional Notes

  • If you're modifying an existing field to act as a metadata field, use the same metadata-kind property—there's no need for a separate metadata flag in 9.2.
  • Always cross-reference the Management API documentation specific to your MarkLogic 9.2 version; the metadata property won't be listed there, as it's a later addition.

内容的提问来源于stack exchange,提问作者Florent Georges

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:55:50