Reputation: 195
I am create a Endpoint to query my Datastore by GQL, and I want to specify the ancestor and property, but GQL seems cannot combine those 2 conditions. Am I missed anythings?
My GQL is:
select * from Product where __key__ HAS ANCESTOR Key(modle1, '0') AND timestamp > 0
And I used the library: com.google.cloud.datastore Is there have any other way to do my goal?
Thanks everyone.
Upvotes: 1
Views: 99
Reputation: 195
Ok, finally I figured out my problem.
I MUST to upload a index definition for my query.
So, I follow this guide - Cloud Datastore Indexes, try to upload my index. I am succeed in the end, but it took me a whole night.
If you use Google Cloud SDK to develop your appengine, there is a small hint for upload index.
Many Q&A or documents said you should upload indexs with appcfg.cmd/appcfg.py/appcfg.sh, but if you are developing appengine with Google Cloud SDK instead of Google Appengine SDK, you should not use that command. Replace with
gcloud app deploy indexes.yaml
or
gcloud datastore create-indexes
Ref: Migrating from AppCfg to gcloud Command Line
No matter what you develop your appengine with, you should write indexes.yaml (If you develop with Java, you will found some documents ask you to write datastore-indexes.xml, drop it, gcloud is seems not support that.).
Upvotes: 1