index.proto 5.9 KB

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