Google Datastore Composite index issue

前端 未结 1 1832
夕颜
夕颜 2021-01-13 07:47

I am getting below exception :

Exception in thread \"main\" com.google.cloud.datastore.DatastoreException: no matching index found. recommended index is:
- k         


        
相关标签:
1条回答
  • 2021-01-13 08:25

    Property order absolutely matters for composite indexes when serving queries. The order is what allows us to serve range queries without having to scan through large sections of the index table. As a general rule, the final property is what you can do the inequality queries on, then the renaming property order defines the order by clause order you can use.

    In your query send_date is what you are doing inequality on, whereas your existing composite index only allows for occasion_name.

    If you create the composite index exactly as the API has returned your query will work.

    0 讨论(0)
提交回复
热议问题