I used Android Studio to create both an Android project, and its backend AppEngine Endpoints counterpart. I have a datastore for which I am using Objectify. The system worked great, until I added a filter to my Query (to show only specific given emails).
Query<Report> query = ofy().load().type(Report.class).filter("email", user.getEmail()).order("email").order("-when").limit(limit);
This is the POJO Datastore Entity:
@Entity
public class Report {
@Id
Long id;
String who;
@Index
Date when;
String what;
@Index
String email;
}
However, I receive such an error from the Google API Explorer when I attempt to test it:
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.
The suggested index for this query is:
<datastore-index kind=\"AccessReport\" ancestor=\"false\" source=\"manual\">
<property name=\"email\" direction=\"asc\"/>
<property name=\"when\" direction=\"desc\"/>
</datastore-index>
As I understand it, I simply need to create a composite index including the specific fields email and when, with their specific sort direction.
However, most documentation that I find tell me to edit datastore-indexes.xml
.
App Engine predefines a simple index on each property of an entity. An App Engine application can define further custom indexes in an index configuration file named datastore-indexes.xml, which is generated in your application's /war/WEB-INF/appengine-generated directory.
Unfortunately, this file does not seem to exist anywhere in my project.
Is anyone familiar with the way to change this when working with Android Studio?