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 /_db/{database-name}/_api/view
Creates a new View with a given name and properties if it does not already exist.
Path Parameters
  • The name of the database.

Query Parameters
    HTTP Headers
      Request Body application/json object
      • 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
      • The View has been created.

          Response Body application/json object
        • A unique identifier of the View. This is an internal property.

        • A unique identifier of the View (deprecated).

        • The list of the View’s inverted indexes.

          • The name of a collection.

          • The name of an inverted index of the collection.

        • The name of the View.

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

      • The name or type attribute or one of the collection or index attributes is missing or invalid. error is returned.

          Response Body application/json object
        • The HTTP response status code.

        • A flag indicating that an error occurred.

        • A descriptive error message.

        • ArangoDB error number for the error that occurred.

      • A View called name already exists.

          Response Body application/json object
        • The HTTP response status code.

        • A flag indicating that an error occurred.

        • A descriptive error message.

        • ArangoDB error number for the error that occurred.

      Examples

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

      Get information about a View

      GET /_db/{database-name}/_api/view/{view-name}
      Returns the basic information about a specific View.
      Path Parameters
      • The name of the database.

      • The name of the View.

      Query Parameters
        HTTP Headers
          Responses
          • The basic information about the View.

              Response Body application/json object
            • The HTTP response status code.

            • A flag indicating that no error occurred.

            • A unique identifier of the View. This is an internal property.

            • A unique identifier of the View (deprecated).

            • The name of the View.

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

          • A View called view-name could not be found.

              Response Body application/json object
            • The HTTP response status code.

            • A flag indicating that an error occurred.

            • A descriptive error message.

            • ArangoDB error number for the error that occurred.

          Examples

          Using an identifier:

          curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/72332'
          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 /_db/{database-name}/_api/view/{view-name}/properties
          Returns an object containing the definition of the View identified by view-name.
          Path Parameters
          • The name of the database.

          • The name of the View.

          Query Parameters
            HTTP Headers
              Responses
              • An object with a full description of the specified View, including search-alias View type-dependent properties.

                  Response Body application/json object
                • A unique identifier of the View. This is an internal property.

                • A unique identifier of the View (deprecated).

                • The list of the View’s inverted indexes.

                  • The name of a collection.

                  • The name of an inverted index of the collection.

                • The name of the View.

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

              • The view-name parameter is missing or invalid.

                  Response Body application/json object
                • The HTTP response status code.

                • A flag indicating that an error occurred.

                • A descriptive error message.

                • ArangoDB error number for the error that occurred.

              • A View called view-name could not be found.

                  Response Body application/json object
                • The HTTP response status code.

                • A flag indicating that an error occurred.

                • A descriptive error message.

                • ArangoDB error number for the error that occurred.

              Examples

              Using an identifier:

              curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/72348/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 /_db/{database-name}/_api/view
              Returns an object containing a listing of all Views in the current database, regardless of their type.
              Path Parameters
              • The name of the database.

              Query Parameters
                HTTP Headers
                  Responses
                  • The list of Views.

                      Response Body application/json object
                    • The HTTP response status code.

                    • A flag indicating that no error occurred.

                    • The result object.

                      • A unique identifier of the View. This is an internal property.

                      • A unique identifier of the View (deprecated).

                      • The name of the View.

                      • The type of the View.

                        Possible values: "arangosearch", "search-alias"

                  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 /_db/{database-name}/_api/view/{view-name}/properties
                  Replaces the list of indexes of a search-alias View.
                  Path Parameters
                  • The name of the database.

                  • The name of the View.

                  Query Parameters
                    HTTP Headers
                      Request Body application/json object
                      • 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
                      • The View has been updated successfully.

                          Response Body application/json object
                        • A unique identifier of the View. This is an internal property.

                        • 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").

                      • The view-name parameter is missing or invalid.

                          Response Body application/json object
                        • The HTTP response status code.

                        • A flag indicating that an error occurred.

                        • A descriptive error message.

                        • ArangoDB error number for the error that occurred.

                      • A View called view-name could not be found.

                          Response Body application/json object
                        • The HTTP response status code.

                        • A flag indicating that an error occurred.

                        • A descriptive error message.

                        • ArangoDB error number for the error that occurred.

                      Examples

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

                      Update the properties of a search-alias View

                      PATCH /_db/{database-name}/_api/view/{view-name}/properties
                      Updates the list of indexes of a search-alias View.
                      Path Parameters
                      • The name of the database.

                      • The name of the View.

                      Query Parameters
                        HTTP Headers
                          Request Body application/json object
                          • 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"

                          Responses
                          • The View has been updated successfully.

                              Response Body application/json object
                            • A unique identifier of the View. This is an internal property.

                            • 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").

                          • The view-name parameter is missing or invalid.

                              Response Body application/json object
                            • The HTTP response status code.

                            • A flag indicating that an error occurred.

                            • A descriptive error message.

                            • ArangoDB error number for the error that occurred.

                          • A View called view-name could not be found.

                              Response Body application/json object
                            • The HTTP response status code.

                            • A flag indicating that an error occurred.

                            • A descriptive error message.

                            • ArangoDB error number for the error that occurred.

                          Examples

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

                          Rename a View

                          PUT /_db/{database-name}/_api/view/{view-name}/rename

                          Renames a View.

                          Renaming Views is not supported in cluster deployments.
                          Path Parameters
                          • The name of the database.

                          • The name of the View to rename.

                          Query Parameters
                            HTTP Headers
                              Responses
                              • The View has been renamed successfully.

                                  Response Body application/json object
                                • A unique identifier of the View. This is an internal property.

                                • 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").

                              • The view-name parameter is missing or invalid.

                                  Response Body application/json object
                                • The HTTP response status code.

                                • A flag indicating that an error occurred.

                                • A descriptive error message.

                                • ArangoDB error number for the error that occurred.

                              • A View called view-name could not be found.

                                  Response Body application/json object
                                • The HTTP response status code.

                                • A flag indicating that an error occurred.

                                • A descriptive error message.

                                • ArangoDB error number for the error that occurred.

                              Examples

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

                              Drop a View

                              DELETE /_db/{database-name}/_api/view/{view-name}
                              Deletes the View identified by view-name.
                              Path Parameters
                              • The name of the database.

                              • The name of the View to drop.

                              Query Parameters
                                HTTP Headers
                                  Responses
                                  • The View has been dropped successfully.

                                      Response Body application/json object
                                    • The HTTP response status code.

                                    • A flag indicating that no error occurred.

                                    • The value true.

                                  • The view-name path parameter is missing or invalid.

                                      Response Body application/json object
                                    • The HTTP response status code.

                                    • A flag indicating that an error occurred.

                                    • A descriptive error message.

                                    • ArangoDB error number for the error that occurred.

                                  • A View called view-name could not be found.

                                      Response Body application/json object
                                    • The HTTP response status code.

                                    • A flag indicating that an error occurred.

                                    • A descriptive error message.

                                    • ArangoDB error number for the error that occurred.

                                  Examples

                                  Using an identifier:

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

                                  Using a name:

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