{ "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 a list of all index descriptions for the given collection. The same information is also available in the identifiers as hash map with the index handle as keys.

", "summary": "reads all indexes of a collection", "httpMethod": "GET", "examples": "Return information about all indexes:

unix> 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      \"fields\" : [ \n        \"_id\" \n      ] \n    } \n  ], \n  \"identifiers\" : { \n    \"products/0\" : { \n      \"id\" : \"products/0\", \n      \"type\" : \"primary\", \n      \"unique\" : true, \n      \"fields\" : [ \n        \"_id\" \n      ] \n    } \n  }, \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "readsAllIndexesOfACollection" } ], "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 objects describing the index. It has at least the following attributes:

- id: The identifier of the index.

- type: The type of the collection.

All other attributes are type-dependent.

", "summary": "reads an index", "httpMethod": "GET", "examples": "

unix> 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  \"fields\" : [ \n    \"_id\" \n  ], \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "readsAnIndex" } ], "path": "/_api/index/{index-handle}" }, { "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": "cap-constraint", "description": "" } ], "notes": "

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

- type: must be equal to \"cap\".

- size: The maximal number of documents for the collection.

Note that 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.

", "summary": "creates a cap constraint", "httpMethod": "POST", "examples": "Creating a cap collection

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

", "nickname": "createsACapConstraint" } ], "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.

- type: must be equal to \"geo\".

- fields: A list with one or two attribute paths.

If it is a list with one attribute path location, then a geo-spatial index on all documents is created using location as path to the coordinates. The value of the attribute must be a list with at least two double values. The list must contain the latitude (first value) and the longitude (second value). All documents, which do not have the attribute path or with value that are not suitable, are ignored.

If it is a list with two attribute paths latitude and longitude, then a geo-spatial index on all documents is created using latitude and longitude as paths the latitude and the longitude. The value of the attribute latitude and of the attribute longitude must a double. All documents, which do not have the attribute paths or which values are not suitable, are ignored.

- geoJson: If a geo-spatial index on a location is constructed and geoJson is true, then the order within the list is longitude followed by latitude. This corresponds to the format described in http://geojson.org/geojson-spec.html#positions

- constraint: If constraint is true, then a geo-spatial constraint is created. The constraint is a non-unique variant of the index. Note that it is also possible to set the unique attribute instead of the constraint attribute.

- ignoreNull: If a geo-spatial constraint is created and ignoreNull is true, then documents with a null in location or at least one null in latitude or longitude are ignored.

", "summary": "creates a geo-spatial index", "httpMethod": "POST", "examples": "Creating a geo index with a location attribute:

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

Creating a geo index with latitude and longitude attributes:

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

", "nickname": "createsAGeo-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.

- type: must be equal to \"hash\".

- fields: A list of attribute paths.

- unique: If true, then create a unique index.

", "summary": "creates a hash index", "httpMethod": "POST", "examples": "Creating an unique constraint:

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

Creating a hash index:

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

", "nickname": "createsAHashIndex" } ], "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.

- type: must be equal to \"skiplist\".

- fields: A list of attribute paths.

- unique: If true, then create a unique index.

", "summary": "creates a skip list", "httpMethod": "POST", "examples": "Creating a skiplist:

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

", "nickname": "createsASkipList" } ], "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.

- type: must be equal to \"fulltext\".

- fields: A list of attribute names. Currently, the list is limited to exactly one attribute, so the value of fields should look like this for example: [ \"text\" ].

- minLength: Minimum character length of words to index. Will default to a server-defined value if unspecified. It is thus recommended to set this value explicitly when creating the index.

", "summary": "creates a fulltext index", "httpMethod": "POST", "examples": "Creating a fulltext index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"fulltext\", \"fields\" : [ \"text\" ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/113519836\", \n  \"type\" : \"fulltext\", \n  \"unique\" : false, \n  \"minLength\" : 2, \n  \"fields\" : [ \n    \"text\" \n  ], \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsAFulltextIndex" } ], "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 bitarray index for the collection collection-name, if it does not already exist. The call expects an object containing the index details.

- type: must be equal to \"bitarray\".

- fields: A list of pairs. A pair consists of an attribute path followed by a list of values.

- unique: Must always be set to false.

", "summary": "creates a bitarray index", "httpMethod": "POST", "examples": "Creating a bitarray index:

unix> curl -X POST --data @- --dump - http://localhost:8529/_api/index?collection=products\n{ \"type\" : \"bitarray\", \"unique\" : false, \"fields\" : [ \"x\", [0,1,[]], \"y\", [\"a\",\"b\",[]] ] }\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/152251612\", \n  \"type\" : \"bitarray\", \n  \"unique\" : false, \n  \"fields\" : [ \n    [ \n      \"x\", \n      [ \n        0, \n        1, \n        [ ] \n      ] \n    ], \n    [ \n      \"y\", \n      [ \n        \"a\", \n        \"b\", \n        [ ] \n      ] \n    ] \n  ], \n  \"undefined\" : false, \n  \"isNewlyCreated\" : true, \n  \"error\" : false, \n  \"code\" : 201 \n}\n\n

", "nickname": "createsABitarrayIndex" } ], "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" } ], "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 new index in the collection collection-name. Expects an object containing the index details.

The type of the index to be created must specified in the type attribute of the index details. Depending on the index type, additional other attributes may need to specified in the request in order to create the index.

See @ref IndexCapHttp, @ref IndexGeoHttp, @ref IndexHashHttp, @ref IndexFulltextHttp, and @ref IndexSkiplistHttp for details.

Most indexes (a notable exception being the cap constraint) require the list of attributes to be indexed in the fields attribute of the index details. Depending on the index type, a single attribute or multiple attributes may be indexed.

Some indexes can be created as unique or non-unique variants. Uniqueness can be controlled for most indexes by specifying the unique in the index details. Setting it to true will create a unique index. Setting it to false or omitting the unique attribute will create a non-unique index.

Note that the following index types do not support uniqueness, and using the unique attribute with these types may lead to an error: - cap constraints- fulltext indexes

", "summary": "creates an index", "httpMethod": "POST", "examples": "", "nickname": "createsAnIndex" } ], "path": "/_api/index" }, { "operations": [ { "errorResponses": [ { "reason": "If the index could be deleted, then a HTTP 202 is returned. ", "code": "202" } ], "parameters": [ { "dataType": "String", "paramType": "query", "required": "True", "name": "index-handle", "description": "The index handle. " } ], "notes": "

Deletes an index with index-handle.

", "summary": "deletes an index", "httpMethod": "DELETE", "examples": "

unix> curl -X DELETE --dump - http://localhost:8529/_api/index/products/190262492\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n  \"id\" : \"products/190262492\", \n  \"error\" : false, \n  \"code\" : 200 \n}\n\n

", "nickname": "deletesAnIndex" } ], "path": "/_api/index/{index-handle}" } ] }