Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Indexing 使用某些索引属性查询数据存储_Indexing_Google Cloud Platform_Google Cloud Firestore_Google Cloud Datastore - Fatal编程技术网

Indexing 使用某些索引属性查询数据存储

Indexing 使用某些索引属性查询数据存储,indexing,google-cloud-platform,google-cloud-firestore,google-cloud-datastore,Indexing,Google Cloud Platform,Google Cloud Firestore,Google Cloud Datastore,我正在尝试云数据存储的索引,但我无法确定解决查询所需的配置 我已经创建了一些相同类型的实体(命名为“对象”),所有这些实体都有5个同名属性(property_0、property_1、…、property_4)。然后,我为这种类型创建了一个复合索引,为所有5个属性编制索引,并在最后一个位置设置属性_4,因为我想对其应用不等式过滤器 该指数的定义如下: indexes: - kind: object ancestor: no properties: - name: property_0

我正在尝试云数据存储的索引,但我无法确定解决查询所需的配置

我已经创建了一些相同类型的实体(命名为“对象”),所有这些实体都有5个同名属性(property_0、property_1、…、property_4)。然后,我为这种类型创建了一个复合索引,为所有5个属性编制索引,并在最后一个位置设置属性_4,因为我想对其应用不等式过滤器

该指数的定义如下:

indexes:
- kind: object
  ancestor: no
  properties:
  - name: property_0
    direction: asc
  - name: property_1
    direction: asc
  - name: property_2
    direction: asc
  - name: property_3
    direction: asc
  - name: property_4
    direction: asc
我试图解决的查询总是在属性_4上应用一个不等式过滤器,并且在其他一些属性上可能存在过滤器。一些例子:

  • 从属性_4>5且属性_0=true的对象中选择*
  • 从属性_4>5和属性_4<10的对象中选择*并 属性_1='已批准'
  • 从属性_4>8的对象中选择*并 属性_2=100,属性_3=true
  • 从属性_4>15且属性_0=true的对象中选择*并 属性_1=草稿,属性_2=10,属性_3=假
唯一有效的查询是,如果我筛选索引中的每个属性,其余属性将显示错误消息“您的数据存储没有此查询所需的复合索引(开发人员提供的)。”


不是所有的查询都应该由创建的索引来解决吗?或者我需要为我想要应用的每个过滤器组合创建一个索引吗?(即,一个索引用于筛选属性_4和属性_0;另一个索引用于筛选属性_4和属性_1;另一个索引用于筛选属性_4、属性_2和属性_3;…)

如果正确,则需要为要应用的过滤器的每个组合创建索引

您可以通过以下方式在index.yaml文件中为单独的查询指定索引:

indexes:
- kind: object
  properties:
  - name: property_0
  - name: property_1
  - name: property_2
  - name: property_3
  - name: property_4

- kind: object
  properties:
  - name: property_3
  - name: property_4
  - name: property_0

...