Reputation: 1404
I am getting the following exception when I am deploying my APP of Google App Engine server with Objectify, although I have already configured all the indexes of my application. Still didn't understand why I am getting this exception, due to this error, I am not able to do anything on this web application.
Exception in Production Server
/search
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.
The suggested index for this query is:
<datastore-index kind="M_TAXI" ancestor="false" source="manual">
<property name="cityName" direction="asc"/>
<property name="updatedOn" direction="asc"/>
</datastore-index>
datastore.indexes.xml
<?xml version="1.0" encoding="UTF-8"?>
<datastore-indexes autoGenerate="true">
<datastore-index kind="M_COUNTRY" ancestor="false" source="auto">
<property name="countryCode" direction="asc" />
<property name="countryName" direction="asc" />
<property name="active" direction="asc" />
</datastore-index>
<datastore-index kind="M_CITY" ancestor="false" source="auto">
<property name="countryCode" direction="asc" />
<property name="cityName" direction="asc" />
<property name="cityCode" direction="asc" />
<property name="active" direction="asc" />
</datastore-index>
<datastore-index kind="M_TAXI" ancestor="false" source="auto">
<property name="cityName" direction="asc" />
<property name="supplierUserName" direction="asc" />
<property name="updatedOn" direction="asc" />
<property name="active" direction="asc" />
<property name="countryName" direction="asc" />
</datastore-index>
</datastore-indexes>
Datastore index image snapshot from production server
Upvotes: 3
Views: 4202
Reputation: 4178
The existing M_TAXI is not usable by the query that threw the exception. Please try inserting
<datastore-index kind="M_TAXI" ancestor="false" source="manual">
<property name="cityName" direction="asc"/>
<property name="updatedOn" direction="asc"/>
</datastore-index>
into datastore.indexes.xml before the </datastore-indexes> end tag and after the other M_TAXI element, and report back what the result was.
Upvotes: 4
Reputation: 2279
You must add these index in your datastore.indexes.xml
<datastore-index kind="M_TAXI" ancestor="false" source="manual">
<property name="cityName" direction="asc"/>
<property name="updatedOn" direction="asc"/>
</datastore-index>
As Appengine datastore is schemaless, you must need to add seperate indexes for different query.
Please refer this stackoverflow post.
Upvotes: 3