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
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
Get information about a View
The result is an object briefly describing the View with the following attributes:
id
: The identifier of the Viewname
: The name of the Viewtype
: The type of the View as string
Examples
Using an identifier:
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/72252'
Using a name:
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/productsView'
Read properties of a View
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.
Examples
Using an identifier:
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/72268/properties'
Using a name:
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/productsView/properties'
List all Views
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
Examples
Return information about all Views:
curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view'
Replace the properties of a search-alias View
search-alias
View.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
Update the properties of a search-alias View
search-alias
View.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
Rename a View
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.
Examples
curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/view/productsView/rename' <<'EOF'
{
"name": "catalogView"
}
EOF
Drop a View
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
Examples
Using an identifier:
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/72318'
Using a name:
curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/view/productsView'