index.yaml reference

The syntax of index.yaml is the YAML format. The index.yaml file has a single list element called indexes. Each element in the list represents an index for the application.


The following is an example of an index.yaml file:


- kind: Cat
  ancestor: no
  - name: name
  - name: age
    direction: desc

- kind: Cat
  - name: name
    direction: asc
  - name: whiskers
    direction: desc

# This pound sign is the syntax for a comment.

- kind: Store
  ancestor: yes
  - name: business
    direction: asc
  - name: owner
    direction: asc


An index element can have the following elements:

Element Description
kind Required. The kind of the entity for the query. This should be the kind argument given to datastore.NewKey when creating the entity.

A list of properties to include as columns of the index, in the order to be sorted: properties used in equality filters first, followed by the property used in inequality filters, then the sort orders and their directions.

Each element in this list has the following elements:

The datastore name of the property.
The direction to sort, either asc for ascending or desc for descending. This is only required for properties used in sort orders of the query, and must match the direction used by the query. The default is asc.
ancestor yes if the query has an ancestor clause ( Query.ancestor() ). The default is no.

Automatic and manual indexes

When the development web server adds a generated index definition to index.yaml, it does so below the following line, inserting it if necessary:


The development web server considers all index definitions below this line to be automatic, and it may update existing definitions below this line as the application makes queries.

All index definitions above this line are considered to be under manual control, and are not updated by the development web server. The web server will only make changes below the line, and will only do so if the complete index.yaml file does not describe an index that accounts for a query executed by the application. To take control of an automatic index definition, move it above this line.

Send feedback about...

App Engine standard environment for Go