I am trying to query the Datastore, and my query looks like this:
SELECT *
FROM mydb
WHERE Latitude = "18.1" AND Number > "1"
It doesn't work though. I get this error in the Datastore query box:
GQL query error: Your Datastore does not have the composite index (developer-supplied) required for this query.
And this error when I run my code:
no matching index found. recommended index is:\n- kind: mydb\n properties:\n - name: Location\n - name: Number\n
Simple requests like this work:
SELECT *
FROM mydb
WHERE Number > "1" AND Number < "5"
I am only accessing a single column here maybe that is why?
Nope,
Then I tried a request like this:
SELECT *
FROM mydb
WHERE Latitude = "18.1" AND Number = "1"
This worked.
I tried to look up a solution, and I came across this page: https://cloud.google.com/datastore/docs/tools/indexconfig#Datastore_About_index_yaml
After going through that page, I gathered that I need an index.yaml file somewhere. It is supposed to go in a folder called WEB-INF. But I don't have this folder.
This is a little snippet of my code:
Query<Entity> query = Query
.gqlQueryBuilder(Query.ResultType.ENTITY,
"SELECT * FROM " + kind + " WHERE Location = @location AND Number <= @number")
.setBinding("number", "5").setBinding("location", "18.1").build();
QueryResults<Entity> results = datastore.run(query);
appengine-web.xml
located? – Pettifog