where to define datastore-indexes.xml in nodeJS project hosted on compute engine?

129 views Asked by At

We are hosting a NodeJS application on compute engine, which connect to google DataStore using gcloud-node. Simple queries are running fine, but complex queries with multipple selects are giving "412: precondition failed" error. More details at": Multiple select in google datastore query throwing ApiError: Precondition Failed error in node

I understand this error is due to the fact I have not configured datastore-indexes.xml. Being a newbie in GCP world. Could you please help me where can I define my datastore-indexes.xml file inside my project.

1

There are 1 answers

1
E. Anderson On

You can also use the gcloud preview app tool with an index.yaml file to specify an indexing policy.

For example, if you need an index on user and timestamp on LoginTimes:

indexes:
 - kind: LoginTimes
   properties:
   - name: user
   - name: timestamp
     direction: desc