xref: /aosp_15_r20/external/googleapis/google/firestore/admin/v1beta1/index.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2019 Google LLC.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15
16syntax = "proto3";
17
18package google.firestore.admin.v1beta1;
19
20import "google/api/annotations.proto";
21
22option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1";
23option go_package = "cloud.google.com/go/firestore/admin/apiv1beta1/adminpb;adminpb";
24option java_multiple_files = true;
25option java_outer_classname = "IndexProto";
26option java_package = "com.google.firestore.admin.v1beta1";
27option objc_class_prefix = "GCFS";
28
29// A field of an index.
30message IndexField {
31  // The mode determines how a field is indexed.
32  enum Mode {
33    // The mode is unspecified.
34    MODE_UNSPECIFIED = 0;
35
36    // The field's values are indexed so as to support sequencing in
37    // ascending order and also query by <, >, <=, >=, and =.
38    ASCENDING = 2;
39
40    // The field's values are indexed so as to support sequencing in
41    // descending order and also query by <, >, <=, >=, and =.
42    DESCENDING = 3;
43
44    // The field's array values are indexed so as to support membership using
45    // ARRAY_CONTAINS queries.
46    ARRAY_CONTAINS = 4;
47  }
48
49  // The path of the field. Must match the field path specification described
50  // by [google.firestore.v1beta1.Document.fields][fields].
51  // Special field path `__name__` may be used by itself or at the end of a
52  // path. `__type__` may be used only at the end of path.
53  string field_path = 1;
54
55  // The field's mode.
56  Mode mode = 2;
57}
58
59// An index definition.
60message Index {
61  // The state of an index. During index creation, an index will be in the
62  // `CREATING` state. If the index is created successfully, it will transition
63  // to the `READY` state. If the index is not able to be created, it will
64  // transition to the `ERROR` state.
65  enum State {
66    // The state is unspecified.
67    STATE_UNSPECIFIED = 0;
68
69    // The index is being created.
70    // There is an active long-running operation for the index.
71    // The index is updated when writing a document.
72    // Some index data may exist.
73    CREATING = 3;
74
75    // The index is ready to be used.
76    // The index is updated when writing a document.
77    // The index is fully populated from all stored documents it applies to.
78    READY = 2;
79
80    // The index was being created, but something went wrong.
81    // There is no active long-running operation for the index,
82    // and the most recently finished long-running operation failed.
83    // The index is not updated when writing a document.
84    // Some index data may exist.
85    ERROR = 5;
86  }
87
88  // The resource name of the index.
89  // Output only.
90  string name = 1;
91
92  // The collection ID to which this index applies. Required.
93  string collection_id = 2;
94
95  // The fields to index.
96  repeated IndexField fields = 3;
97
98  // The state of the index.
99  // Output only.
100  State state = 6;
101}
102