-
Notifications
You must be signed in to change notification settings - Fork 653
Description
Playing around with this today (after seeing this issue #1916 has been resolved) and I'm noticing that you have to define each and every embedded object property that you would like unindexed, instead of being able to just define a single "catch all" excludeFromIndexes option.
This works (actually it doesn't really, see edit below...):
{
"key": { ... },
"excludeFromIndexes": [
"testEmbeddedObject.otherStringThing",
"testEmbeddedObject.stringThing",
"testLongString"
],
"data": {
"testLongString": "really long string here",
"testEmbeddedObject": {
"stringThing": "really long string here",
"otherStringThing": "really long string here"
}
}
}
But this does not:
{
"key": { ... },
"excludeFromIndexes": [
"testEmbeddedObject",
"testLongString"
],
"data": {
"testLongString": "really long string here",
"testEmbeddedObject": {
"stringThing": "really long string here",
"otherStringThing": "really long string here"
}
}
}
In the second example I'm still getting an error for stringThing and otherStringThing being longer than 1500 bytes. Is there no way to define that it catches all the properties in an embedded object?
Maybe something like this, if you'd like the catch all to have a more intentional syntax:
"excludeFromIndexes": [
"testEmbeddedObject.*",
"testLongString"
],
Though, I would hope that for this syntax of propertyName.*, which seems to say catch all properties of the object at propertyName, would also catch things that are not embedded objects but also simply a long string at that propertyName. I would just like a way to define that data stored at a certain property of an entity should not be indexed at all - be it a string, embedded object or whatever.
EDIT:
Upon thinking about it more, why does the syntax in my second example not work? I think putting a * wildcard shouldn't be necessary actually. You've deliberately indicated you do not want that property indexed and that should mean the entire property, be it an embedded object and all it's properties or just a long string. If you'd still like to index some properties of an embedded object, then you'd define those which you want unindexed and leave out the ones you want indexed.
This is confusing because upon looking at my entities in the datastore console it appears that my first example is actually wrong. I should have included the base testEmbeddedObject in my exclusion array too, so it would look like this now:
"excludeFromIndexes": [
"testEmbeddedObject",
"testEmbeddedObject.otherStringThing",
"testEmbeddedObject.stringThing",
"testLongString"
],
Otherwise, the datastore console still sees that "base" property as indexed even though there is no data on it.
Environment details
- OS: Windows 10
- Node.js version: 8.2.1
- npm version: 5.3.0
- google-cloud-node version: 1.1.0