ArangoDB

HTTP interface for search-alias Views

The HTTP API for Views lets you manage search-alias Views, including adding and removing inverted indexes

Create a search-alias View

post /_api/view#searchalias
Creates a new View with a given name and properties if it does not already exist.
Request Body application/json
  • A list of inverted indexes to add to the View.

    • The name of a collection.

    • The name of an inverted index of the collection, or the index ID without the <collection>/ prefix.

  • The name of the View.

  • The type of the View. Must be equal to "search-alias". This option is immutable.

Responses
  • If the name or type attribute are missing or invalid, then an HTTP 400 error is returned.

  • If a View called name already exists, then an HTTP 409 error is returned.

Examples

curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view
{
  "name": "products",
  "type": "search-alias",
  "indexes": [
    {
      "collection": "books",
      "index": "inv-idx"
    }
  ]
}
Show output

Get information about a View

get /_api/view/{view-name}

The result is an object briefly describing the View with the following attributes:

  • id: The identifier of the View
  • name: The name of the View
  • type: The type of the View as string
Path Parameters
  • The name of the View.

Query Parameters
    Responses
    • If the view-name is unknown, then a HTTP 404 is returned.

    Examples

    Using an identifier:

    curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/70822
    Show output

    Using a name:

    curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/productsView
    Show output

    Read properties of a View

    get /_api/view/{view-name}/properties#searchalias

    Returns an object containing the definition of the View identified by view-name.

    The result is an object with a full description of a specific View, including View type dependent properties.

    Path Parameters
    • The name of the View.

    Query Parameters
      Responses
      • If the view-name is missing, then a HTTP 400 is returned.

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

      Examples

      Using an identifier:

      curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/71021/properties
      Show output

      Using a name:

      curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/productsView/properties
      Show output

      List all Views

      get /_api/view

      Returns an object containing a listing of all Views in a database, regardless of their type. It is an array of objects with the following attributes:

      • id
      • name
      • type
      Responses
      • The list of Views

      Examples

      Return information about all Views:

      curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view
      Show output

      Replace the properties of a search-alias View

      put /_api/view/{view-name}/properties#searchalias
      Replaces the list of indexes of a search-alias View.
      Path Parameters
      • The name of the View.

      Query Parameters
        Request Body application/json
        • A list of inverted indexes for the View.

          • The name of a collection.

          • The name of an inverted index of the collection, or the index ID without the <collection>/ prefix.

        Responses
        • On success, an object with the following attributes is returned

            Response Body
          • The identifier of the View.

          • The list of inverted indexes that are part of the View.

            • The name of a collection.

            • The name of an inverted index of the collection.

          • The name of the View.

          • The View type ("search-alias").

        • If the view-name is missing, then a HTTP 400 is returned.

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

        Examples

        curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view/productsView/properties
        {
          "indexes": [
            {
              "collection": "books",
              "index": "inv_descr"
            }
          ]
        }
        Show output

        Update the properties of a search-alias View

        patch /_api/view/{view-name}/properties#searchalias
        Updates the list of indexes of a search-alias View.
        Path Parameters
        • The name of the View.

        Query Parameters
          Request Body application/json
          • A list of inverted indexes to add to or remove from the View.

            • The name of a collection.

            • The name of an inverted index of the collection, or the index ID without the <collection>/ prefix.

            • Whether to add or remove the index to the stored indexes property of the View. Possible values: "add", "del". The default is "add".

          Responses
          • On success, an object with the following attributes is returned

              Response Body
            • The identifier of the View.

            • The list of inverted indexes that are part of the View.

              • The name of a collection.

              • The name of an inverted index of the collection.

            • The name of the View.

            • The View type ("search-alias").

          • If the view-name is missing, then a HTTP 400 is returned.

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

          Examples

          curl -X PATCH --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view/productsView/properties
          {
            "indexes": [
              {
                "collection": "books",
                "index": "inv_descr"
              }
            ]
          }
          Show output

          Rename a View

          put /_api/view/{view-name}/rename

          Renames a View. Expects an object with the attribute(s)

          • name: The new name

          It returns an object with the attributes

          • id: The identifier of the View.
          • name: The new name of the View.
          • type: The View type.

          Note: This method is not available in a cluster.

          Path Parameters
          • The name of the View to rename.

          Query Parameters
            Responses
            • If the view-name is missing, then a HTTP 400 is returned.

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

            Examples

            curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view/productsView/rename
            {
              "name": "catalogView"
            }
            Show output

            Drop a View

            delete /_api/view/{view-name}

            Drops the View identified by view-name.

            If the View was successfully dropped, an object is returned with the following attributes:

            • error: false
            • id: The identifier of the dropped View
            Path Parameters
            • The name of the View to drop.

            Query Parameters
              Responses
              • If the view-name is missing, then a HTTP 400 is returned.

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

              Examples

              Using an identifier:

              curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/view/71675
              Show output

              Using a name:

              curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/view/productsView
              Show output