Index

Index( name )
Index( name )
Index( name )
Index( name )
index( name )
index name
Index( name )
Index( name )

Description

The Index function returns a valid Ref for the given index name.

Parameters

Argument Type Definition and Requirements

name

String

The name of an index.

Returns

A reference to an index with the provided name.

Examples

The query below gets a reference to the index named "spells_by_element".

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "index": "spells_by_element" }'
client.Query(Index("spells_by_element"));
System.out.println(client.query(Index(Value("spells_by_element"))).get());
result, _ := client.Query(f.Index("spells_by_element"))

fmt.Println(result)
client.query(Index("spells_by_element"))
client.query(q.index("spells_by_element"))
$client.query do
  index 'spells_by_element'
end
client.query(Index("spells_by_element"))
client.query(q.Index("spells_by_element"))
  .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))

Was this article helpful?

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

Thank you for your feedback!