Loading TOC...

POST /v1/config/query/(default|{name})


Create or append to named query options.

URL Parameters
format? You can use this parameter as a fallback to the request Content-type header. The Content-type header takes precedence over format in most cases; for details, see Controlling Input and Output Content Type in the REST Application Developer's Guide.
Request Headers
Content-Type The MIME type of the data in the POST body, either application/json or application/xml.


Upon success, MarkLogic Server returns status 201 (Created) or 204 (Updated).

If the payload is invalid, MarkLogic Server responds with status 400 by default. However, validation may be disabled. For details, see /config/properties.

Required Privileges

This operation requires the rest-admin role, or the following privileges:




Usage Notes

The POST body must be a valid search:options node, expressed in either XML or JSON, depending upon the request Content-Type header or format parameter. For options information, see PUT /v1/config/query/(default|{name}).

If the named options do not exist, new ones are created. If the named options exist, the options in the POST body are added to the existing definition.

If {name} is default, default query options are installed or updated.

Named query options are versioned by MarkLogic server. The version identifier returned in the response ETag header may be used in subsequent conditional GET requests to the /config/query/{name} service to restrict requests to particular option versions.

For a summary of available options, see PUT /v1/config/query/(default|{name}). For details, see Appendix: Query Options Reference in the Search Developer's Guide.

For more details, see Configuring Query Options in the REST Application Developer's Guide.


$ cat > options
<options xmlns="http://marklogic.com/appservices/search">
  <constraint name="title">
      <element ns="" name="TITLE" />

$ curl --anyauth --user user:password -X POST -d@'./options' -i \
  -H "Content-type:application/xml" \

==> Install options named "title" which constrains searches
    to words in the TITLE element. The request returns headers of
    the form:

Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close

HTTP/1.1 201 Created
Server: MarkLogic
Content-Length: 0
Connection: close

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