List all indexes

Problem

Retrieve a list of all existing indexes within the current database.

Solution

Use the Indexes function combined with the Paginate function:

Copied!
(())
{
  data: [
    ("spells_by_element"),
    ("spellbooks_by_owner"),
    ("spells_by_spellbook"),
    ("spells_by_element_and_name"),
    ("elements_of_spells"),
    ("letters"),
    ("people_by_age_first"),
    ("people_by_last_first"),
    ("users_by_email"),
    ("products_by_customer"),
    ("products_by_store"),
    ("inventory_by_product"),
    ("products_by_price_high_to_low"),
    ("products_by_price_low_to_high"),
    ("all_customers"),
    ("all_orders"),
    ("all_products"),
    ("all_stores"),
    ("people_by_fullname"),
    ("all_people"),
    ("people_by_age_desc"),
    ("people_by_first"),
    ("people_by_first_last")
  ]
}
Query metrics:
  •    bytesIn:    29

  •   bytesOut: 1,757

  • computeOps:     1

  •    readOps:     8

  •   writeOps:     0

  •  readBytes: 1,174

  • writeBytes:     0

  •  queryTime: 199ms

  •    retries:     0

Discussion

The Paginate function defaults to returning up to 64 indexes per page. If your database contains more than 64 indexes, you can use the size parameter to retrieve up to 100,000 indexes at once.

More information

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!