views:

78

answers:

2

And if not, why not?

The following index always fails to build on the production server, even though I had thought I could have a sort order with a list property as long as the index didn't sort or match against any other properties.

- kind: Foo
  properties:
  - name: location_geocells
  - name: time
    direction: desc

If such a composite index is allowed, are there any reasons that this index might fail to be created for me? Do the existence of other indices on the same model increase the likelihood of this failure?

Does the combination of a sort order with a list property require more than N entries, where N is the number of values in the list property? (If so, how many does it require?)

Update: The error I'm encountering is simply that the index can't be built on the appspot server, it's always in the Error state upon trying to add the index. As I understand the documentation on indexes, I can't see more detailed logs but infer that there must be some entity for which this index requires more than 5000 entries, which surprises me, since the location_geocells StringListProperty has only 16 items for each entity, unless I'm miscalculating how many index entries this index requires (hence my question).

If there are other ways to debug an index in an Error state (like logs of what went wrong in creating the index), that would be invaluable information.

A: 

Can you explain it a little further. Do you have your index created and serving on the production server(appspot) or it is pending or not created at all.

Ilian Iliev
Sorry, should have been more specific. When I try to build the index on the appspot server, it always ends up (before ever Serving) in an Error state. (Updated my question to be more clear.)
npdoty
Is it possible that you have reached the limit of 100 indexes or trying to add a index to a property that still not exists in the database e.g. you added a new property to your model, and index over it but when uploading the changes to the production server the property is still not created in the datastore?
Ilian Iliev
+1  A: 

Yes - list properties are indexed as 'multiply valued properties', with one index row per list entry. The index you specify should work fine.

You're not specific about why it "doesn't work". What problem are you encountering?

Nick Johnson
Sorry, should have been more specific. When I try to build the index on the appspot server, it always ends up in an Error state. (Updated my question to be more clear.)
npdoty
How big are your location_geocells lists?
Nick Johnson
Answering that question was non-trivial. The intention was that each list would only have 16 items, but a bug has caused some of the entities to have hundreds (400+) of items in the list, which may be our problem.How many items in a list is too many for this index to work? Or, to get back towards my original question, how do I calculate how many index entries are required for a composite index on a list of N items?
npdoty
400 shouldn't be so many that it fails - it only ought to have issues if it's in the thousands - but reducing it will certainly help. As far as how to calculate the number of index entries, it's roughly the product of the number of values for each item in your composite index. I say roughly, because introducing ancestor indexes, and indexes that index the same field multiple times complicate the calculations.
Nick Johnson