ERROR: API error 1 (datastore_v3: BAD_REQUEST): Property {} is too long. Maximum length is 500.

113 views
Skip to first unread message

Matthew Ridley

unread,
Jun 16, 2015, 4:29:01 PM6/16/15
to appengine-...@googlegroups.com
I have the following struct:
 
type Article struct {
    Key int64           `datastore:"-"`
Title string
Text string
Author string
        Tags string
Posted time.Time
}

When I try to store any record with Text > 500 characters I get the error:
ERROR: API error 1 (datastore_v3: BAD_REQUEST): Property Text is too long. Maximum length is 500.

When I look here:

It looks like I can store up to 1 MB of text. So not sure why I am getting this error.

Patrick Costello

unread,
Jun 16, 2015, 4:47:07 PM6/16/15
to appengine-...@googlegroups.com
Hi Matthew,

This is a discuss list for users of the ndb python library. I would recommend directing questions about go to either the App Engine issue tracker (https://code.google.com/p/googleappengine/issues/list) or to stackoverflow with the [gae-datastore] and [go] tags.

In this particular case, you can only put strings up to 1MB if you mark that the property is not indexable. (Indexed strings are limited to 1500 bytes -- previously 500 characters). It looks like you are getting this error from a development stub that has not been updated to show the correct length of 1500 -- if you encounter the message about a max length of 500 after updating, please file a bug on the App Engine issue tracker).

I'm not very familiar with go, but I believe you can mark Text as unindexed by writing:

type Article struct {
        Key int64           `datastore:"-"`
Title string
Text string         `datastore:",noindex"`

Author string
        Tags string
Posted time.Time
}

- Patrick

--
You received this message because you are subscribed to the Google Groups "appengine-ndb-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appengine-ndb-di...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Ridley

unread,
Jun 16, 2015, 6:45:50 PM6/16/15
to appengine-...@googlegroups.com
Sorry about that, looks like when I clicked on a group to open a topic, it defaulted to this rather than the go one. However your answer helped. I was outdated and needed to remove the index. Both changes fixed my issue.

Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to appengine-ndb-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages