Ashish Anand
Ashish Anand

Reputation: 55

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

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.

Upvotes: 2

Views: 125

Answers (1)

E. Anderson
E. Anderson

Reputation: 3493

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

Upvotes: 2

Related Questions