Indexes

Indexes( [database] )
Indexes( [database] )
Indexes( [database] )
Indexes( [database] )
indexes( [database] )
indexes [database]
Indexes( [database] )
Indexes( [database] )

Description

The Indexes function, when executed with Paginate, returns an array of References for all indexes in the specified child database. If a child database is not specified, the returned index references all belong to the current database.

When a child database is specified, an admin key must be used to call Indexes (server or client keys, or ABAC tokens, cannot be used to access a child database).

Parameters

Argument Type Definition and Requirements

database

Optional - A reference to a child database. If not specified, the current database is used.

Returns

A Set reference for the available indexes in the specified child database (or the current database if database is not specified).

Examples

The following query gets the references to all indexes in the current database:

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "paginate": { "indexes": null } }'
client.Query(Paginate(Indexes()));
System.out.println(client.query(Paginate(Indexes())).get());
result, _ := client.Query(f.Paginate(f.Indexes()))

fmt.Println(result)
client.query(Paginate(Indexes()))
client.query(q.paginate(q.indexes()))
$client.query do
  paginate indexes
end
client.query(Paginate(Indexes()))
client.query(q.Paginate(q.Indexes()))
.then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": [{ "@ref": "indexes/spells_by_element" }] }
[{ "@ref": "indexes/spells_by_element" }]
[ref(id = "spells_by_element", collection = ref(id = "indexes"))]
[{spells_by_element 0xc4202d0fa0 <nil>}]
[{ "@ref": "indexes/spells_by_element" }]
[{ "@ref": "indexes/spells_by_element" }]
[{ "@ref": "indexes/spells_by_element" }]
[{ "@ref": "indexes/spells_by_element" }]
[Ref(id=spells_by_element, collection=Ref(id=indexes))]

The following query demonstrates what happens when no indexes exist:

Value result = await client.Query(
  Paginate(Indexes())
);

IResult<Value> data = result.To<Value>();
data.Match(
  Success: value => Console.WriteLine($"{value}"),
  Failure: error => Console.WriteLine($"Query failed:\n{error}")
);
result, err := client.Query(
  f.Paginate(f.Indexes()))

if (err != nil) {
  fmt.Println(err)
} else {
  fmt.Println(result)
}
System.out.println(
    client.query(
        Paginate(Indexes())
    ).get());
client.query(
  q.Paginate(q.Indexes())
)
.then((ret) => console.log(ret))
print(client.query(
  q.paginate(q.indexes())
))
println(Await.result(
  client.query(
    Paginate(Indexes())
  ),
  5.seconds
))
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
ObjectV(data: Arr())
map[data:[]]
{data: []}
{ data: [] }
{'data': []}
{data: []}

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!