-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
State of "excludeFromIndexes" (datastore) #14
Comments
December 12, 2017 8:58 PMHey @sebelga! I don't believe We originally only supported the old {
"data": {
"systems": {
"a": "123c",
"b": "456c"
},
"phoneNumber": "0123456789"
"createdAt": "2017-12-12T06:16:35.145Z"
}
} Let me know if that doesn't fix the issue, or if that style for |
@sebelga Hi @stephenplusplus ! Ok I will give it a try and come back with my results. I've found inconsistencies (see my comment here googleapis/google-cloud-node#2510 (comment)) and haven't been able to find the proper way to both declare "excludeFromIndexes" for a simple properties, for Arrays (exclude all their properties) and for a properties on an embedded entity. I will give a try with what you comment and let you know. 👍 |
@beaulac If #2773 is merged, it would allow this syntax to also support (non-nested) arrays. |
I have been doing some test and now I remember why I mixed the old "array" style for the data with the new more robust excludeFromIndexes array declaration. If we declare an "array" property as being "excludeFromIndexes" an error is returned:
So this entity will throw an error {
"key": {
"namespace": "my.namespace",
"kind": "MyEntity",
"path": [
"MyEntity",
null
]
},
"data": {
"phoneNumber": "123-456",
"systems": {
"abc": 123
},
"tags": [
"abc",
"def"
],
"createdAt": "2017-12-18T18: 40: 50.287Z"
},
"excludeFromIndexes": [
"phoneNumber",
"systems",
"createdAt",
"systems.abc",
"tags" // tags is an Array. It throws an error
]
} Will #2773 fix this issue? |
@sebelga I believe this is resolved with the latest release. Could you give it a shot and let me know? Thanks! |
@stephenplusplus ok thanks! I am out on holidays, I'll give it a try next week and let you know. |
Sounds great and happy holidays! I'll close the issue for now, but we can re-open if needed :) |
@stephenplusplus I confirm that it does work, thanks! And thank you @beaulac for the #18 👍 |
This is not fixed! I am using
I tested it with the very same example entity as @sebelga posted above:
I get the same old error: "INVALID_ARGUMENT: Exclude from indexes cannot be set on a list value". |
Oh! I'm sorry! I forgot to include in the example the modified syntax as described in #2773 (old repo):
So changing the test example syntax to
makes it work. Thanks for the quick reopening. Can be closed again already. :) |
However, this here, as described in #2773 (old repo) by @beaulac, does not quite work as expected by me:
In this case, both array elements (the primitive string value and the object containing "name" property) are excluded from indexes. However, the array itself (without any of its elements?) is still included in the index. I can exclude the array completely from indexes only if I rewrite it in the property-array syntax like this:
Maybe this should have been clear already, but it was not for me. So I'm just dropping that here for anyone else who might encounter that problem. I think a detailed explanation of all the different modes of excluding from indexes and what works together with what would really be necessary for the docs, if it does not yet exist. (I have not come across it.) |
Agreed that the different ways of doing this should be more clear in the docs. |
Copied from original issue: googleapis/google-cloud-node#2770
@sebelga
December 12, 2017 6:35 AM
Hello,
I have seen that since version 1.1.0 of the datastore api there is a new syntax for the "excludeFromIndexes" allowing embedded entities to have their properties excluded from indexes.
I am wondering if this new syntax is currently supported as it is not yet in the "master" documentation (it only appears under the "1.1.0" version).
I am sending the following payload to save an entity but all of the properties are marked as "indexed" in the google cloud console. Thus the "excludeFromIndexes" is not working as expected.
Thank for any help on this!
The text was updated successfully, but these errors were encountered: