API Reference / API Methods / Manage indices / List indices

List Indices

Required API Key: any key with the listIndexes ACL
Method signature
$client->listIndices()

About this method

You are currently reading the documentation of the JavaScript API Client v4. Read our migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.

Get a list of indices with their associated metadata.

This method retrieves a list of all indices associated with a given application id.

The returned list includes the name of the index as well as its associated metadata, such as the number of records, size, last build time, and pending tasks.

Calling this method returns all indices, with no paging. So if there are 1000s of indices for a certain application id, then all 1000 indices will be returned at the same time.

The returned list complies with any ACL restrictions of the API key used to retrieve them. For example, if you’re using an API key that only has access to some indices, you will only retrieve these.

Examples

1
var_dump($client->listIndices());

Parameters

No parameters for this method.

Response

In this section we document the JSON response returned by the API. Each language will encapsulate this response inside objects specific to the language and/or the implementation. So the actual type in your language might differ from what is documented.

JSON format

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "items":[
    {
      "name": "airports",
      "createdAt": "2017-05-15T08:09:45.173Z",
      "updatedAt": "2017-05-15T08:09:45.173Z",
      "entries":  1005,
      "dataSize": 0,
      "fileSize": 0,
      "lastBuildTimeS": 1,
      "numberOfPendingTasks": 0,
      "pendingTask": false,
      "primary": 'primary_index',
      "replicas": [],
    },
    [...]
  ],
  "nbPages":1
}
items
list of
nbPages
integer

The value is always 1. There is currently no pagination for this method. Every index is returned on the first call.

items ➔ index object

name
string

Index name.

createdAt
string

Index creation date. An empty string means that the index has no records.

updatedAt
string

Date of last update. An empty string means that the index has no records.

entries
integer

Number of records contained in the index.

dataSize
integer

Number of bytes of the index in minified format.

fileSize
integer

Number of bytes of the index binary file.

lastBuildTimeS
integer

Last build time in seconds.

numberOfPendingTasks
integer

Number of pending indexing operations.

pendingTask
boolean

A boolean which says whether the index has pending tasks.

primary
string

Only present if the index is a replica. Contains the name of the related primary index.

replicas
string[]

Only present if the index is a primary index with replicas. Contains the names of all linked replicas.

Did you find this page helpful?