index.proto 5.9 KB

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