ArangoDB v3.10 reached End of Life (EOL) and is no longer supported.

This documentation is outdated. Please see the most recent stable version.

Working with multi-dimensional indexes

Create a multi-dimensional index

POST /_api/index
Creates a multi-dimensional index for the collection collection-name, if it does not already exist. The call expects an object containing the index details.
Path Parameters
    Query Parameters
    • The collection name.

    HTTP Headers
      Request Body application/json object
      • must be equal to "double". Currently only doubles are supported as values.

      • an array of attribute names used for each dimension. Array expansions are not allowed.

      • You can set this option to true to create the index in the background, which will not write-lock the underlying collection for as long as if the index is built in the foreground. The default value is false.

      • An easy-to-remember name for the index to look it up or refer to it in index hints. Index names are subject to the same character restrictions as collection names. If omitted, a name is auto-generated so that it is unique with respect to the collection, e.g. idx_832910498.

      • must be equal to "zkd".

      • if true, then create a unique index.

      Responses
      • If the index already exists, then a HTTP 200 is returned.

      • If the index does not already exist and could be created, then a HTTP 201 is returned.

      • If the index definition is invalid, then a HTTP 400 is returned.

      • If the collection-name is unknown, then a HTTP 404 is returned.

      Examples

      Creating a multi-dimensional index

      curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/index?collection=intervals
      {
        "type": "zkd",
        "fields": [
          "from",
          "to"
        ],
        "fieldValueTypes": "double"
      }
      Show output
      HTTP/1.1 201 Created
      content-type: application/json
      cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
      connection: Keep-Alive
      content-length: 197
      content-security-policy: frame-ancestors 'self'; form-action 'self';
      expires: 0
      pragma: no-cache
      server: ArangoDB
      strict-transport-security: max-age=31536000 ; includeSubDomains
      x-arango-queue-time-seconds: 0.000000
      x-content-type-options: nosniff
      
      { 
        "fieldValueTypes" : "double", 
        "fields" : [ 
          "from", 
          "to" 
        ], 
        "id" : "intervals/70970", 
        "isNewlyCreated" : true, 
        "name" : "idx_1795421227124260864", 
        "sparse" : false, 
        "type" : "zkd", 
        "unique" : false, 
        "error" : false, 
        "code" : 201 
      }