Question

I'm trying to run GQL query on my datastore. Something like this:

SELECT * FROM products WHERE model = @model AND date >= @date

But there's error like:

You need an index to execute this query.

In google api documentation i found nothing about indexes for nodejs. How i can set this indexes?

Was it helpful?

Solution

Unfortunatly as of today the gcd tool doesn't support automatic index generation for languages using the JSON interface (like Node.js or Ruby).

A workaround is the manually define your index in <your-dataset-directory>/WEB-INF/datastore-indexes.xml

<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes
  autoGenerate="true">
    <datastore-index kind="product" ancestor="false">
        <property name="model" direction="asc" />
        <property name="date" direction="asc" />
    </datastore-index>
</datastore-indexes>

See the Index Configuration section of the datastore documentation for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top