I am executing this CURL command to create element range index under Database : Schemas in MarkLogic.
Below is the CURL command :
CURL -X POST --digest -u admin:admin@123 -H "Content-type: application/json" \
-d '{
"range-element-indexes":[
{"scalar-type":"dateTime",
"namespace-uri":"",
"localname":"test",
"collation":"",
"range-value-positions":"",
"invalid-values":"reject",
}
]
}' \
http://127.0.0.1:8002/manage/v2/databases/Schemas/properties
I am getting no error , but I see no element range created in the server.
CodePudding user response:
I see two issues:
The /manage/v2/databases/{id|name}/properties supports GET and PUT verbs, not POST. So, you are going to want to change the POST to PUT.
In the JSON payload the property
range-element-indexes
should berange-element-index
(singular, not plural). It's a little confusing, but the differences between the XML format and the JSON format is that in XML there is a containing element calledrange-element-indexes
that has a sequence ofrange-element-index
children, but in JSON there is just arange-element-index
property that has an array of objects. The documentation listing the properties is modeled from the XML and schema, not the JSON payloads.
After making those adjustments, I was able to PUT and create the range-index on my local instance.