2

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

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

Note that for production use, you probably want to manually update your datastore indexes rather than automatically uploading index.yaml each time. In particular: 1) It can take some time to update your indexes, so you probably want to upload new indexes before your app. 2) If you are using multiple modules, they all share the same datastore and indexes, so you probably want to keep the datastore configuration in e.g. a separate directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.