I am baffled with a problem with my DataStore query on GAE java -- it always complain that I don't have a matching index, even though I have the exact index they suggested in my datastore-indexes.xml -- can something shed some light before I pull all my hair out?
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.
The suggested index for this query is:
<datastore-index kind="Users" ancestor="false" source="manual">
<property name="BILLING_ENABLED" direction="asc"/>
<property name="EXPIRED" direction="asc"/>
<property name="api" direction="asc"/>
<property name="CREATION" direction="asc"/>
</datastore-index>
My datastore-indexes.xml
<datastore-indexes autoGenerate="true">
<datastore-index kind="Users" ancestor="false" source="manual">
<property name="BILLING_ENABLED" direction="asc"/>
<property name="EXPIRED_DATE" direction="asc"/>
<property name="EXPIRED" direction="asc"/>
<property name="api" direction="asc"/>
<property name="CREATION" direction="asc"/>
</datastore-index>
</datastore-indexes>
My Query:
Query q = new Query("Users");
Filter filter = CompositeFilterOperator.and(new FilterPredicate("api", Query.FilterOperator.EQUAL,
"val"), new FilterPredicate(EXPIRED, Query.FilterOperator.EQUAL, Boolean.FALSE));
filter = CompositeFilterOperator.and(filter, new FilterPredicate("BILLING_ENABLED", Query.FilterOperator.EQUAL, Boolean.FALSE));
filter = CompositeFilterOperator.and(filter, new FilterPredicate("CREATION", Query.FilterOperator.LESS_THAN_OR_EQUAL, cal.getTime()));
If I understand correctly, I need indexes for "api", "EXPIRED", "BILLING_ENABLED", and "CREATION" since these are used in the query -- but is there anything else I need?
Thanks, Adrian