Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google Datastore index remains empty

We're using an Angular front-end, a NodeJS back-end, and Google Datastore for storage, with an API built on GraphQL.

Currently, we're facing an issue with retrieving specific fields from Google Datastore to our API. We're trying to optimize our queries to only fetch relevant fields using GraphQL, rather than retrieving all fields.

To achieve this, I'm using projections as follows:

const forSaleQuery = datastore.createQuery('Vessel').filter('status', '=', 'FOR_SALE').select(requestedFields);

I've created the relevant indices for these projections, as per the documentation. However, the queries return empty results, and when I check in Datastore Studio, the indexes remain empty and haven’t populated even after a day.

Is there a way to trigger or expedite the population of these indexes? Any insight into why the indexes are not being populated would be greatly appreciated.

Thank you for your assistance!

0 2 203
2 REPLIES 2

Hi @anthonyvh,

Welcome to the Google Cloud Community!

Possible reasons why a query could fail to return results are:

  • Query syntax or structure is incorrect
  • Missing or mismatched data for the specified filter (status = 'FOR_SALE').
  • Network issues or incorrect network configuration

Here are a few steps to troubleshoot:

If you received any error codes, could you share them? Or include a screenshot of what happens when you run the query for more context. You can also try to run the Datastore Emulator on your local machine, then test if your query successfully retrieves from the database to help narrow down the possible causes.

If these don’t resolve the issue, feel free to reach out to Google Cloud support, create a question on the Datastore Stack Overflow, or open an issue on our GitHub issue tracker for more assistance.

I hope this helps!

Hi,

Are you sure you have the right indices (right property names, right ordering, etc)?

If possible, try and run your code locally using Datastore Emulator[1]. This will lead to the relevant indices being automatically created on your local machine. You can then compare this with the one you manually created and can even deploy this index file to production (gcloud).

[1] Datastore Emulator  > In addition, the emulator can help you generate indexes for your production Datastore instance and delete unneeded indexes.

 

   ......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator