如何从Flyway脚本创建或验证Marklogic中的ElementRangeIndexes。每次迁移Marklogic DB,都要手动记住ElementRangeIndex,这是一件很痛苦的事情。
你也许可以使用 Flyway gradle插件,执行 ml-gradle 配置脚本。
或者,您也可以使用 gradle执行curl命令 并使用 MarkLogic管理API 端点。
一个使用Curl定义一个来自于 学习MarkLogic REST API:
curl -X PUT --anyauth --user admin:admin --header "Content-Type:application/json" \
-d '{"word-positions": true,
"element-word-positions": true,
"range-element-index":
[ { "scalar-type": "string",
"namespace-uri": "",
"localname": "SPEAKER",
"collation": "http://marklogic.com/collation/",
"range-value-positions": false,
"invalid-values": "reject"
},
{ "scalar-type": "string",
"namespace-uri": "",
"localname": "affiliation",
"collation": "http://marklogic.com/collation/",
"range-value-positions": false,
"invalid-values": "reject"
},
{ "scalar-type": "int",
"namespace-uri": "",
"localname": "contentRating",
"collation": "",
"range-value-positions": false,
"invalid-values": "reject"
},
{ "scalar-type": "unsignedLong",
"namespace-uri": "http://marklogic.com/filter",
"localname": "size",
"collation": "",
"range-value-positions": false,
"invalid-values": "reject"
},
{ "scalar-type": "string",
"namespace-uri": "http://marklogic.com/filter",
"localname": "Exposure_Time",
"collation": "http://marklogic.com/collation/",
"range-value-positions": false,
"invalid-values": "reject"
}]}' \
http://localhost:8002/manage/v2/databases/TutorialDB/properties