ArangoDB v3.13 is under development and not released yet.
This documentation is not final and potentially incomplete.
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
database-name*
string
The name of the database.
Request Body application/json object
indexes
array of objects
A list of inverted indexes to add to the View.
collection*
string
The name of a collection.
index*
string
The name of an inverted index of the collection
, or the index ID without
the <collection>/
prefix.
name*
string
type*
string
The type of the View. Must be equal to "search-alias"
.
This option is immutable.
Responses
201
Created
The View has been created.
400
Bad Request
The name
or type
attribute or one of the collection
or index
attributes is missing or invalid.
error is returned.
409
Conflict
A View called name
already exists.
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 outputHTTP/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: 148
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
{
"globallyUniqueId" : "h7F0F0D5E4468/70971",
"id" : "70971",
"name" : "products",
"type" : "search-alias",
"indexes" : [
{
"collection" : "books",
"index" : "inv-idx"
}
]
}
get
/_db/{database-name}/_api/view/{view-name}
Returns the basic information about a specific View.
Path Parameters
database-name*
string
The name of the database.
view-name*
string
Responses
200
OK
The basic information about the View.
404
Not Found
A View called view-name
could not be found.
Examples
Using an identifier:
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/71063
Show outputHTTP/1.1 200 OK
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: 124
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
{
"error" : false,
"code" : 200,
"type" : "arangosearch",
"name" : "productsView",
"id" : "71063",
"globallyUniqueId" : "h7F0F0D5E4468/71063"
}
Using a name:
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/productsView
Show outputHTTP/1.1 200 OK
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: 124
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
{
"error" : false,
"code" : 200,
"type" : "arangosearch",
"name" : "productsView",
"id" : "71203",
"globallyUniqueId" : "h7F0F0D5E4468/71203"
}
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
database-name*
string
The name of the database.
view-name*
string
Responses
200
OK
An object with a full description of the specified View, including
search-alias
View type-dependent properties.
400
Bad Request
The view-name
parameter is missing or invalid.
404
Not Found
A View called view-name
could not be found.
Examples
Using an identifier:
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/71343/properties
Show outputHTTP/1.1 200 OK
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: 177
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
{
"error" : false,
"code" : 200,
"type" : "search-alias",
"name" : "productsView",
"indexes" : [
{
"collection" : "books",
"index" : "inv-idx"
}
],
"id" : "71343",
"globallyUniqueId" : "h7F0F0D5E4468/71343"
}
Using a name:
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view/productsView/properties
Show outputHTTP/1.1 200 OK
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: 177
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
{
"error" : false,
"code" : 200,
"type" : "search-alias",
"name" : "productsView",
"indexes" : [
{
"collection" : "books",
"index" : "inv-idx"
}
],
"id" : "71455",
"globallyUniqueId" : "h7F0F0D5E4468/71455"
}
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
database-name*
string
The name of the database.
Examples
Return information about all Views:
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/view
Show outputHTTP/1.1 200 OK
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: 328
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
{
"error" : false,
"code" : 200,
"result" : [
{
"globallyUniqueId" : "h7F0F0D5E4468/181",
"id" : "181",
"name" : "demoView",
"type" : "arangosearch"
},
{
"globallyUniqueId" : "h7F0F0D5E4468/71572",
"id" : "71572",
"name" : "productsView",
"type" : "search-alias"
},
{
"globallyUniqueId" : "h7F0F0D5E4468/71573",
"id" : "71573",
"name" : "reviewsView",
"type" : "arangosearch"
}
]
}
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
database-name*
string
The name of the database.
view-name*
string
Request Body application/json object
indexes
array of objects
A list of inverted indexes for the View.
collection*
string
The name of a collection.
index*
string
The name of an inverted index of the collection
, or the index ID without
the <collection>/
prefix.
Responses
200
OK
The View has been updated successfully.
400
Bad Request
The view-name
parameter is missing or invalid.
404
Not Found
A View called view-name
could not be found.
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 outputHTTP/1.1 200 OK
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: 154
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
{
"globallyUniqueId" : "h7F0F0D5E4468/71675",
"id" : "71675",
"name" : "productsView",
"type" : "search-alias",
"indexes" : [
{
"collection" : "books",
"index" : "inv_descr"
}
]
}
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
database-name*
string
The name of the database.
view-name*
string
Request Body application/json object
indexes
array of objects
A list of inverted indexes to add to or remove from the View.
collection*
string
The name of a collection.
index*
string
The name of an inverted index of the collection
, or the index ID without
the <collection>/
prefix.
operation
string (default: "add"
)
Whether to add or remove the index to the stored indexes
property of the View.
Possible values: "add"
, "del"
Responses
200
OK
The View has been updated successfully.
400
Bad Request
The view-name
parameter is missing or invalid.
404
Not Found
A View called view-name
could not be found.
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 outputHTTP/1.1 200 OK
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
{
"globallyUniqueId" : "h7F0F0D5E4468/71777",
"id" : "71777",
"name" : "productsView",
"type" : "search-alias",
"indexes" : [
{
"collection" : "books",
"index" : "inv_title"
},
{
"collection" : "books",
"index" : "inv_descr"
}
]
}
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
database-name*
string
The name of the database.
view-name*
string
The name of the View to rename.
Responses
200
OK
The View has been renamed successfully.
400
Bad Request
The view-name
parameter is missing or invalid.
404
Not Found
A View called view-name
could not be found.
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view/productsView/rename
{
"name": "catalogView"
}
Show outputHTTP/1.1 200 OK
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: 492
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
{
"globallyUniqueId" : "h7F0F0D5E4468/71887",
"id" : "71887",
"name" : "catalogView",
"type" : "arangosearch",
"cleanupIntervalStep" : 2,
"commitIntervalMsec" : 1000,
"consolidationIntervalMsec" : 1000,
"consolidationPolicy" : {
"type" : "tier",
"segmentsBytesFloor" : 2097152,
"segmentsBytesMax" : 5368709120,
"segmentsMax" : 10,
"segmentsMin" : 1,
"minScore" : 0
},
"optimizeTopK" : [ ],
"primarySort" : [ ],
"primarySortCompression" : "lz4",
"storedValues" : [ ],
"writebufferActive" : 0,
"writebufferIdle" : 64,
"writebufferSizeMax" : 33554432,
"links" : {
}
}
Drop a View
delete
/_db/{database-name}/_api/view/{view-name}
Deletes the View identified by view-name
.
Path Parameters
database-name*
string
The name of the database.
view-name*
string
The name of the View to drop.
Responses
200
OK
The View has been dropped successfully.
400
Bad Request
The view-name
path parameter is missing or invalid.
404
Not Found
A View called view-name
could not be found.
Examples
Using an identifier:
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/view/72027
Show outputHTTP/1.1 200 OK
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: 40
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
{
"error" : false,
"code" : 200,
"result" : true
}
Using a name:
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/view/productsView
Show outputHTTP/1.1 200 OK
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: 40
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
{
"error" : false,
"code" : 200,
"result" : true
}