0

I have a kind name 'Wdr'. My index.yaml file looks like this .

indexes:
-kind: Wdr
 ancestor: yes
 properties:
 -name : wdr_id
 -name : wdr_sub_id
  direction: desc

I am not able to run this gql query below.

SELECT * FROM  Wdr where wdr_id = '1098' order by wdr_sub_id desc 

The eror i get is..

GQL Query error: Your Datastore does not have the composite index (developer-supplied) required for this query.

Is the indexes define in the .yaml file is not correct? or am i doing something else wrong here?

Hsn
  • 1,168
  • 2
  • 16
  • 39

1 Answers1

1

Your index definition contains ancestor: yes, this means that your query should contain an ancestor filter. You can either add an ancestor filter to your query or change your index definition to ancestor: no.

Jim Morrison
  • 2,784
  • 1
  • 7
  • 11
  • 'SELECT * from `Wdr` WHERE __key__ HAS ANCESTOR Key(Tan, 'f347e5bd-8204-4ff1-b7a5-ae2b65a7ac38') ORDER BY welder_sub_id asc ' this query didnt worked too – Hsn May 20 '20 at 14:29
  • 'SELECT * from `Wdr` WHERE __key__ HAS ANCESTOR Key(Tan, 'f347efbd-8204-4ff1-b7a5-aecb65a7ac38') ORDER BY wd_start_time asc' What indexes should i add for this query? – Hsn May 20 '20 at 14:37
  • 1
    The error message from trying to use the query should give the needed index. I'd expect it to be `kind: Wdr ancestor: yes properties: -name : wdr_sub_id/wd_start_time direction: asc` – Jim Morrison May 21 '20 at 15:21