Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retroactive indexing in Google Cloud Datastore

There are many properties in my model that I currently don't need indexed but can imagine I might want indexed at some unknown point in the future. If I explicitly set indexed=False for a property now but change my mind down the road, will Datastore rebuild the entire indices automatically at that point, including for previously written data? Are there any other repercussions for taking this approach?

like image 214
rusty1042 Avatar asked Jan 08 '14 23:01

rusty1042


People also ask

What is index in datastore?

An index is defined on a list of properties of a given entity kind, with a corresponding order (ascending or descending) for each property. For use with ancestor queries, the index may also optionally include an entity's ancestors. An index table contains a column for every property named in the index's definition.

How to remove index from datastore?

When you are sure that old indexes are no longer needed, you can delete them by using the datastore indexes cleanup command. This command deletes all indexes for the production Datastore mode instance that are not mentioned in the local version of index.

What is index configuration?

You can use the index configuration of a Source Type to provide important information about how data of that Source Type is indexed in IBM® Operations Analytics Log Analysis Managed. Index configuration is specified using JSON configuration notation.

Is Google Datastore deprecated?

The Cloud Datastore Administration API v1beta1 is now deprecated. The Cloud Datastore Admin backup feature is being phased out in favor of the managed export and import for Cloud Datastore. Please migrate to the managed export and import functionality at your earliest convenience.


1 Answers

No, changing indexed=True to indexed=False (and vice-versa) will only affect entities written after that point to the datastore. Here is the documentation that talks about it and the relevant paragraph:

Similarly, changing a property from indexed to unindexed only affects entities subsequently written to the Datastore. The index entries for any existing entities with that property will continue to exist until the entities are updated or deleted. To avoid unwanted results, you must purge your code of all queries that filter or sort by the (now unindexed) property.

If you decide later that you want to starting indexing properties, you'll have to go through your entities and re-put them into the datastore.

Note, however, that 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 the Datastore so that they will be entered in the appropriate indexes. That is, you must do the following for each such existing entity:

Retrieve (get) the entity from the Datastore.

Write (put) the entity back to the Datastore.

like image 188
Patrick Costello Avatar answered Sep 20 '22 17:09

Patrick Costello