lifeofguenter
lifeofguenter

Reputation: 1181

GAE Datastore composite index not working

For some reason one of my composite index with google datastore is not working.

I am getting zero results with the following query:

SELECT * FROM `Foobar` WHERE `ver` = 20180814 AND `level` = 1

However the index is created (though showing zero size even though it has been created couple of days ago):

screenshot of created+serving index

I double checked that the fields are both integers and I am also getting zero results on the local sdk.

index.yaml:

indexes:

- kind: Foobar
  properties:
  - name: ver
  - name: level
    direction: desc

Upvotes: 4

Views: 717

Answers (1)

lifeofguenter
lifeofguenter

Reputation: 1181

as pointed out by @Dan, composite indices only work if the property of the entity is indexed itself (built-in), see: https://cloud.google.com/datastore/docs/concepts/indexes#index_definition_and_structure

An entity is included in the index only if it has an indexed value set for every property used in the index

Upvotes: 4

Related Questions