{ "basePath": "/", "swaggerVersion": "1.1", "apiVersion": "0.1", "apis": [ { "operations": [ { "errorResponses": [], "parameters": [ { "dataType": "String", "paramType": "query", "required": true, "name": "collection", "description": "The collection name.

" } ], "notes": "

Returns an object with an attribute indexes containing an array of all index descriptions for the given collection. The same information is also available in the identifiers as an object with the index handles as keys.

", "summary": " Read all indexes of a collection", "httpMethod": "GET", "examples": "

Return information about all indexes:



shell> curl --dump - http://localhost:8529/_api/index?collection=products\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"indexes\" : [ \n    { \n      \"id\" : \"products/0\", \n      \"type\" : \"primary\", \n      \"unique\" : true, \n      \"sparse\" : false, \n      \"selectivityEstimate\" : 1, \n      \"fields\" : [ \n        \"_key\" \n      ] \n    }, \n    { \n      \"id\" : \"products/1245062197\", \n      \"type\" : \"hash\", \n      \"unique\" : false, \n      \"sparse\" : false, \n      \"selectivityEstimate\" : 1, \n      \"fields\" : [ \n        \"name\" \n      ] \n    }, \n    { \n      \"id\" : \"products/1245324341\", \n      \"type\" : \"skiplist\", \n      \"unique\" : false, \n      \"sparse\" : true, \n      \"fields\" : [ \n        \"price\" \n      ] \n    } \n  ], \n  \"identifiers\" : { \n    \"products/0\" : { \n      \"id\" : \"products/0\", \n      \"type\" : \"primary\", \n      \"unique\" : true, \n      \"sparse\" : false, \n      \"selectivityEstimate\" : 1, \n      \"fields\" : [ \n        \"_key\" \n      ] \n    }, \n    \"products/1245062197\" : { \n      \"id\" : \"products/1245062197\", \n      \"type\" : \"hash\", \n      \"unique\" : false, \n      \"sparse\" : false, \n      \"selectivityEstimate\" : 1, \n      \"fields\" : [ \n        \"name\" \n      ] \n    }, \n    \"products/1245324341\" : { \n      \"id\" : \"products/1245324341\", \n      \"type\" : \"skiplist\", \n      \"unique\" : false, \n      \"sparse\" : true, \n      \"fields\" : [ \n        \"price\" \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "ReadAllIndexesOfACollection" } ], "path": "/_api/index" }, { "operations": [ { "errorResponses": [ { "reason": "If the index exists, then a HTTP 200 is returned.

", "code": "200" }, { "reason": "If the index does not exist, then a HTTP 404 is returned.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "path", "required": true, "name": "index-handle", "description": "The index-handle.

" } ], "notes": "

The result is an object describing the index. It has at least the following attributes:

All other attributes are type-dependent. For example, some indexes provide unique or sparse flags, whereas others don't. Some indexes also provide a selectivity estimate in the selectivityEstimate attribute of the result.

", "summary": "Read index", "httpMethod": "GET", "examples": "



shell> curl --dump - http://localhost:8529/_api/index/products/0\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/0\", \n  \"type\" : \"primary\", \n  \"unique\" : true, \n  \"sparse\" : false, \n  \"selectivityEstimate\" : 1, \n  \"fields\" : [ \n    \"_key\" \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n



", "nickname": "ReadIndex" } ], "path": "/_api/index/{index-handle}" }, { "operations": [ { "errorResponses": [ { "reason": "If the index already exists, then an HTTP 200 is returned.

", "code": "200" }, { "reason": "If the index does not already exist and could be created, then an HTTP 201 is returned.

", "code": "201" }, { "reason": "If either size or byteSize contain invalid values, then an HTTP 400 is returned.

", "code": "400" }, { "reason": "If the collection-name is unknown, then a HTTP 404 is returned.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "query", "required": true, "name": "collection", "description": "The collection name.

" }, { "dataType": "Json", "paramType": "body", "required": true, "name": "cap-constraint", "description": "

" } ], "notes": "

Creates a cap constraint for the collection collection-name, if it does not already exist. Expects an object containing the index details.

Note: The cap constraint does not index particular attributes of the documents in a collection, but limits the number of documents in the collection to a maximum value. The cap constraint thus does not support attribute names specified in the fields attribute nor uniqueness of any kind via the unique attribute.

It is allowed to specify either size or byteSize, or both at the same time. If both are specified, then the automatic document removal will be triggered by the first non-met constraint.

", "summary": " Create cap constraint", "httpMethod": "POST", "examples": "

Creating a cap constraint



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{\"type\":\"cap\",\"size\":10}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1246045237\", \n  \"type\" : \"cap\", \n  \"unique\" : false, \n  \"size\" : 10, \n  \"byteSize\" : 0, \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "CreateCapConstraint" } ], "path": "/_api/index" }, { "operations": [ { "errorResponses": [ { "reason": "If the index already exists, then a HTTP 200 is returned.

", "code": "200" }, { "reason": "If the index does not already exist and could be created, then a HTTP 201 is returned.

", "code": "201" }, { "reason": "If the collection-name is unknown, then a HTTP 404 is returned.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "query", "required": true, "name": "collection", "description": "The collection name.

" }, { "dataType": "Json", "paramType": "body", "required": true, "name": "index-details", "description": "

" } ], "notes": "

Creates a geo-spatial index in the collection collection-name, if it does not already exist. Expects an object containing the index details.

Geo indexes are always sparse, meaning that documents that do not contain the index attributes or have non-numeric values in the index attributes will not be indexed.

", "summary": " Create geo-spatial index", "httpMethod": "POST", "examples": "

Creating a geo index with a location attribute:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{ \n  \"type\" : \"geo\", \n  \"fields\" : [ \n    \"b\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1246569525\", \n  \"type\" : \"geo1\", \n  \"unique\" : false, \n  \"sparse\" : true, \n  \"geoJson\" : false, \n  \"constraint\" : false, \n  \"ignoreNull\" : true, \n  \"fields\" : [ \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Creating a geo index with latitude and longitude attributes:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{ \n  \"type\" : \"geo\", \n  \"fields\" : [ \n    \"e\", \n    \"f\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1247093813\", \n  \"type\" : \"geo2\", \n  \"unique\" : false, \n  \"sparse\" : true, \n  \"constraint\" : false, \n  \"ignoreNull\" : true, \n  \"fields\" : [ \n    \"e\", \n    \"f\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "CreateGeo-spatialIndex" } ], "path": "/_api/index" }, { "operations": [ { "errorResponses": [ { "reason": "If the index already exists, then a HTTP 200 is returned.

", "code": "200" }, { "reason": "If the index does not already exist and could be created, then a HTTP 201 is returned.

", "code": "201" }, { "reason": "If the collection already contains documents and you try to create a unique hash index in such a way that there are documents violating the uniqueness, then a HTTP 400 is returned.

", "code": "400" }, { "reason": "If the collection-name is unknown, then a HTTP 404 is returned.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "query", "required": true, "name": "collection-name", "description": "The collection name.

" }, { "dataType": "Json", "paramType": "body", "required": true, "name": "index-details", "description": "

" } ], "notes": "

Creates a hash index for the collection collection-name if it does not already exist. The call expects an object containing the index details. The following attributes can be present in the body of the request object:

In a sparse index all documents will be excluded from the index that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes. Such documents will not be indexed, and not be taken into account for uniqueness checks if the unique flag is set.

In a non-sparse index, these documents will be indexed (for non-present indexed attributes, a value of null will be used) and will be taken into account for uniqueness checks if the unique flag is set.

Note: unique indexes on non-shard keys are not supported in a cluster.

", "summary": " Create hash index", "httpMethod": "POST", "examples": "

Creating an unique constraint:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{ \n  \"type\" : \"hash\", \n  \"unique\" : true, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1247618101\", \n  \"type\" : \"hash\", \n  \"unique\" : true, \n  \"sparse\" : false, \n  \"selectivityEstimate\" : 1, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Creating a non-unique hash index:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{ \n  \"type\" : \"hash\", \n  \"unique\" : false, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1248142389\", \n  \"type\" : \"hash\", \n  \"unique\" : false, \n  \"sparse\" : false, \n  \"selectivityEstimate\" : 1, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Creating a sparse index:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{ \n  \"type\" : \"hash\", \n  \"unique\" : false, \n  \"sparse\" : true, \n  \"fields\" : [ \n    \"a\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1248601141\", \n  \"type\" : \"hash\", \n  \"unique\" : false, \n  \"sparse\" : true, \n  \"selectivityEstimate\" : 1, \n  \"fields\" : [ \n    \"a\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "CreateHashIndex" } ], "path": "/_api/index" }, { "operations": [ { "errorResponses": [ { "reason": "If the index already exists, then a HTTP 200 is returned.

", "code": "200" }, { "reason": "If the index does not already exist and could be created, then a HTTP 201 is returned.

", "code": "201" }, { "reason": "If the collection already contains documents and you try to create a unique skip-list index in such a way that there are documents violating the uniqueness, then a HTTP 400 is returned.

", "code": "400" }, { "reason": "If the collection-name is unknown, then a HTTP 404 is returned.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "query", "required": true, "name": "collection-name", "description": "The collection name.

" }, { "dataType": "Json", "paramType": "body", "required": true, "name": "index-details", "description": "

" } ], "notes": "

Creates a skip-list index for the collection collection-name, if it does not already exist. The call expects an object containing the index details. The following attributes can be present in the body of the request object:

In a sparse index all documents will be excluded from the index that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes. Such documents will not be indexed, and not be taken into account for uniqueness checks if the unique flag is set.

In a non-sparse index, these documents will be indexed (for non-present indexed attributes, a value of null will be used) and will be taken into account for uniqueness checks if the unique flag is set.

Note: unique indexes on non-shard keys are not supported in a cluster.

", "summary": " Create skip list", "httpMethod": "POST", "examples": "

Creating a skiplist index:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{ \n  \"type\" : \"skiplist\", \n  \"unique\" : false, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1249125429\", \n  \"type\" : \"skiplist\", \n  \"unique\" : false, \n  \"sparse\" : false, \n  \"fields\" : [ \n    \"a\", \n    \"b\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



Creating a sparse skiplist index:



shell> curl -X POST --data-binary @- --dump - http://localhost:8529/_api/index?collection=products <<EOF\n{ \n  \"type\" : \"skiplist\", \n  \"unique\" : false, \n  \"sparse\" : true, \n  \"fields\" : [ \n    \"a\" \n  ] \n}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/1249584181\", \n  \"type\" : \"skiplist\", \n  \"unique\" : false, \n  \"sparse\" : true, \n  \"fields\" : [ \n    \"a\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n



", "nickname": "CreateSkipList" } ], "path": "/_api/index" }, { "operations": [ { "errorResponses": [ { "reason": "If the index already exists, then a HTTP 200 is returned.

", "code": "200" }, { "reason": "If the index does not already exist and could be created, then a HTTP 201 is returned.

", "code": "201" }, { "reason": "If the collection-name is unknown, then a HTTP 404 is returned.

", "code": "404" } ], "parameters": [ { "dataType": "String", "paramType": "query", "required": true, "name": "collection-name", "description": "The collection name.

" }, { "dataType": "Json", "paramType": "body", "required": true, "name": "index-details", "description": "

" } ], "notes": "

Creates a fulltext index for the collection collection-name, if it does not already exist. The call expects an object containing the index details. The following attributes can be present in the body of the request object: