java - Google Cloud Datastore - Inequality returning "no matching index found" -
in android studio, i'm trying use google clood datastore android app.
with google example https://cloud.google.com/datastore/docs/concepts/indexes#datastore_indexes_and_properties able add tom (32 years old) , lucy (30 years old) person , children of company acme. can see these 2 entries in datastore in google developers console.
i can retrieve children company acme if set query filter below.
key acmekey = makekey("company", "acme").build(); makefilter("__key__", propertyfilter.operator.has_ancestor, makevalue(acmekey)).build()));
- if want retrieve person age equal 32 add filter above
makefilter("age", propertyfilter.operator.equal, makevalue(32)).build()
then, person tom.
- if want retrieve person age equal 32 add filter above
- but, if, instead of
operator.equal
put inequality filteroperator.less_than
oroperator.greater_than
error "no matching index found".
i think it's problem of indexes, don't understand how can set index. use android studio , don't use @ app engine. want retrieve data mysql simple where age > 32
.
btw, tried gql , exact same problem, work equal
, not greater_than
(and same in https://developers.google.com/apis-explorer).
so, know how can fix problem ? !!
index configuration cloud datastore handled using gcd.sh tool.
it's easiest if you're able run queries against local datastore provided gcd.sh
. tool can determine indexes you'll need, , can use updateindexes
command configure them on production app.
if not, can configure indexes hand:
gcd.sh create <project> -d <project>
- create file @
<project>/web-inf/datastore-indexes.xml
following content:
<?xml version="1.0" encoding="utf-8"?> <datastore-indexes autogenerate="true"> <datastore-index kind="company" ancestor="true"> <property name="age" direction="asc" /> </datastore-index> </datastore-indexes>
gcd.sh updateindexes <project>
the exact content of file depend on queries want run. this page gives additional details on format of indexes file.
Comments
Post a Comment