index.proto 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // Copyright 2022 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. syntax = "proto3";
  15. package google.firestore.admin.v1;
  16. import "google/api/resource.proto";
  17. option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
  18. option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1;admin";
  19. option java_multiple_files = true;
  20. option java_outer_classname = "IndexProto";
  21. option java_package = "com.google.firestore.admin.v1";
  22. option objc_class_prefix = "GCFS";
  23. option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
  24. option ruby_package = "Google::Cloud::Firestore::Admin::V1";
  25. // Cloud Firestore indexes enable simple and complex queries against
  26. // documents in a database.
  27. message Index {
  28. option (google.api.resource) = {
  29. type: "firestore.googleapis.com/Index"
  30. pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}"
  31. };
  32. // Query Scope defines the scope at which a query is run. This is specified on
  33. // a StructuredQuery's `from` field.
  34. enum QueryScope {
  35. // The query scope is unspecified. Not a valid option.
  36. QUERY_SCOPE_UNSPECIFIED = 0;
  37. // Indexes with a collection query scope specified allow queries
  38. // against a collection that is the child of a specific document, specified
  39. // at query time, and that has the collection id specified by the index.
  40. COLLECTION = 1;
  41. // Indexes with a collection group query scope specified allow queries
  42. // against all collections that has the collection id specified by the
  43. // index.
  44. COLLECTION_GROUP = 2;
  45. }
  46. // A field in an index.
  47. // The field_path describes which field is indexed, the value_mode describes
  48. // how the field value is indexed.
  49. message IndexField {
  50. // The supported orderings.
  51. enum Order {
  52. // The ordering is unspecified. Not a valid option.
  53. ORDER_UNSPECIFIED = 0;
  54. // The field is ordered by ascending field value.
  55. ASCENDING = 1;
  56. // The field is ordered by descending field value.
  57. DESCENDING = 2;
  58. }
  59. // The supported array value configurations.
  60. enum ArrayConfig {
  61. // The index does not support additional array queries.
  62. ARRAY_CONFIG_UNSPECIFIED = 0;
  63. // The index supports array containment queries.
  64. CONTAINS = 1;
  65. }
  66. // Can be __name__.
  67. // For single field indexes, this must match the name of the field or may
  68. // be omitted.
  69. string field_path = 1;
  70. // How the field value is indexed.
  71. oneof value_mode {
  72. // Indicates that this field supports ordering by the specified order or
  73. // comparing using =, !=, <, <=, >, >=.
  74. Order order = 2;
  75. // Indicates that this field supports operations on `array_value`s.
  76. ArrayConfig array_config = 3;
  77. }
  78. }
  79. // The state of an index. During index creation, an index will be in the
  80. // `CREATING` state. If the index is created successfully, it will transition
  81. // to the `READY` state. If the index creation encounters a problem, the index
  82. // will transition to the `NEEDS_REPAIR` state.
  83. enum State {
  84. // The state is unspecified.
  85. STATE_UNSPECIFIED = 0;
  86. // The index is being created.
  87. // There is an active long-running operation for the index.
  88. // The index is updated when writing a document.
  89. // Some index data may exist.
  90. CREATING = 1;
  91. // The index is ready to be used.
  92. // The index is updated when writing a document.
  93. // The index is fully populated from all stored documents it applies to.
  94. READY = 2;
  95. // The index was being created, but something went wrong.
  96. // There is no active long-running operation for the index,
  97. // and the most recently finished long-running operation failed.
  98. // The index is not updated when writing a document.
  99. // Some index data may exist.
  100. // Use the google.longrunning.Operations API to determine why the operation
  101. // that last attempted to create this index failed, then re-create the
  102. // index.
  103. NEEDS_REPAIR = 3;
  104. }
  105. // Output only. A server defined name for this index.
  106. // The form of this name for composite indexes will be:
  107. // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}`
  108. // For single field indexes, this field will be empty.
  109. string name = 1;
  110. // Indexes with a collection query scope specified allow queries
  111. // against a collection that is the child of a specific document, specified at
  112. // query time, and that has the same collection id.
  113. //
  114. // Indexes with a collection group query scope specified allow queries against
  115. // all collections descended from a specific document, specified at query
  116. // time, and that have the same collection id as this index.
  117. QueryScope query_scope = 2;
  118. // The fields supported by this index.
  119. //
  120. // For composite indexes, this is always 2 or more fields.
  121. // The last field entry is always for the field path `__name__`. If, on
  122. // creation, `__name__` was not specified as the last field, it will be added
  123. // automatically with the same direction as that of the last field defined. If
  124. // the final field in a composite index is not directional, the `__name__`
  125. // will be ordered ASCENDING (unless explicitly specified).
  126. //
  127. // For single field indexes, this will always be exactly one entry with a
  128. // field path equal to the field path of the associated field.
  129. repeated IndexField fields = 3;
  130. // Output only. The serving state of the index.
  131. State state = 4;
  132. }