Reputation: 447
i stored some entities in the datastore from my golang-appengine-project. I annotated some fields with 'noindex', so it didn't create simple indices for some columns.
Now i removed the noindex-annotation but i don't know how to rebuild the index. I tried:
gcloud datastore create-indexes ../path/to/file/index.yaml
But it didn't rebuild index. So i can only search recently added values, but not old values.
How can i rebuild the index?
Thanks
Upvotes: 1
Views: 1019
Reputation: 88
Unfortunately, the only way to index a property, which was previously unindexed, is to update/rewrite the entity to datastore.
From the documentation at https://cloud.google.com/appengine/docs/java/datastore/indexes:
... changing a property from unindexed to indexed does not affect any existing entities that may have been created before the change. Queries filtering on the property will not return such existing entities, because the entities weren't written to the query's index when they were created. To make the entities accessible by future queries, you must rewrite them to Datastore so that they will be entered in the appropriate indexes.
Upvotes: 2