Loading TOC...

POST /manage/v2/databases/{id|name}/partition-queries

Summary

Add a query to a query partition in the specified database.

URL Parameters
format The format of the data in the request body. Can be either json, or xml. Use this parameter to override the Content-type header.
Request Headers
Accept The expected MIME type of the response. If the format parameter is present, it takes precedence over the Accept header.
Content-type The MIME type of the data in the request body. If the format parameter is present, it takes precedence over this header. Accepted values: application/xml, application/json.
Response Headers
Location A reference to the newly created partition with which you can construct a URL for the resource that is usable in subsequent requests. For example, /manage/v2/databases/your-db-id/partitions/your-partition-name.
Content-type The MIME type of the data in the response body. Depending upon the value of the format parameter or Accept header, one of application/xml, application/json, or text/html.

Response

Upon success, MarkLogic server returns status code 201 (Created). If the payload is malformed or if the query already exists, a status code of 400 (Bad Request) is returned. A status code of 401 (Unauthorized) is returned if the user does not have the necessary privileges.

Required Privileges

This operation requires the manage-admin role, or the following privilege:

http://marklogic.com/xdmp/privileges/manage-admin

Usage Notes

For more details, see Setting the Query Assignment Policy for the Query Partition in the Administrator's Guide.

The structure of the data in the request body is as follows:

partition-name

Name of the partition.

partition-number

upper-bound

The upper bound of the range on the forest.

lower-bound

The lower bound of the range on the forest.

forests-per-host

Number of forests to distribute per host.

hosts

A list of hosts.

This is a complex structure with the following children:

host

A host name or id.

replicas

Number of forests to allocate to each host for partition creation.

data-directory

The optional public directory for forests.

large-data-directory

The optional directory for large objects in a forest.

fast-data-directory

The optional smaller but faster directory for forests.

options

A list of options.

This is a complex structure with the following children:

option

An option.

Example


curl -X POST  --anyauth -u admin:admin -H "Content-Type:application/xml" \
-d '<partition-query-properties xmlns="http://marklogic.com/manage/partition-query/properties">
      <partition-number>2</partition-number>
        <query>
          <cts:or-query xmlns:cts="http://marklogic.com/cts">
            <cts:word-query>
               <cts:text xml:lang="en">Manager</cts:text>
            </cts:word-query>
            <cts:word-query>
               <cts:text xml:lang="en">Engineer</cts:text>
            </cts:word-query>
          </cts:or-query>
        </query>
    </partition-query-properties>' \
http://gordon-1:8002/manage/v2/databases/Schemas/partition-queries 
    

Example


curl -X POST --anyauth --user admin:admin -H "Content-type: application/json" \
-d '{
  "partition-number": "2",
  "query": {
    "queries": [{
      "or-query": {
        "queries": [
          {
            "term-query": {
              "text": ["Manager"]
            }
          },
          {
            "term-query": {
              "text": [ "Engineer" ]
            }
          }
        ]}
    }]
}}' \
http://gordon-1:8002/manage/v2/databases/Schemas/partition-queries
 
    

Comments

  • The Usage Notes part is wrong, it targets the /manage/v2/databases/{id|name}/partitions (POST) query
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy