index.proto 5.6 KB

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