-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathindex.proto
192 lines (153 loc) · 4.41 KB
/
index.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
syntax = "proto3";
package index;
option go_package = "github.com/mosuka/phalanx/proto";
service Index {
rpc LivenessCheck (LivenessCheckRequest) returns (LivenessCheckResponse) {}
rpc ReadinessCheck (ReadinessCheckRequest) returns (ReadinessCheckResponse) {}
rpc Metrics (MetricsRequest) returns (MetricsResponse) {}
rpc Cluster (ClusterRequest) returns (ClusterResponse) {}
rpc CreateIndex (CreateIndexRequest) returns (CreateIndexResponse) {}
rpc DeleteIndex (DeleteIndexRequest) returns (DeleteIndexResponse) {}
rpc AddDocuments (AddDocumentsRequest) returns (AddDocumentsResponse) {}
rpc DeleteDocuments (DeleteDocumentsRequest) returns (DeleteDocumentsResponse) {}
rpc Search (SearchRequest) returns (SearchResponse) {}
}
enum LivenessState {
LIVENESS_STATE_UNKNOWN = 0;
LIVENESS_STATE_ALIVE = 1;
LIVENESS_STATE_DEAD = 2;
}
enum ReadinessState {
READINESS_STATE_UNKNOWN = 0;
READINESS_STATE_READY = 1;
READINESS_STATE_NOT_READY = 2;
}
message LivenessCheckRequest {
}
message LivenessCheckResponse {
LivenessState state = 1;
}
message ReadinessCheckRequest {
}
message ReadinessCheckResponse {
ReadinessState state = 1;
}
message MetricsRequest {
}
message MetricsResponse {
bytes metrics = 1;
}
enum NodeRole {
NODE_ROLE_UNKNOWN = 0;
NODE_ROLE_INDEXER = 1;
NODE_ROLE_SEARCHER = 2;
}
enum NodeState {
NODE_STATE_UNKNOWN = 0;
NODE_STATE_ALIVE = 1;
NODE_STATE_SUSPECT = 2;
NODE_STATE_DEAD = 3;
NODE_STATE_LEFT = 4;
}
message NodeMeta {
uint32 grpc_port = 1 [json_name="grpc_port"];
uint32 http_port = 2 [json_name="http_port"];
repeated NodeRole roles = 3;
}
message Node {
string addr = 1;
uint32 port = 2;
NodeMeta meta = 3;
NodeState state = 4;
}
message ShardMetadata {
string shard_uri = 1 [json_name="shard_uri"];
string shard_lock_uri = 2 [json_name="shard_lock_uri"];
}
message IndexMetadata {
string index_uri = 1 [json_name="index_uri"];
string index_lock_uri = 2 [json_name="index_lock_uri"];
bytes index_mapping = 3 [json_name="index_mapping"];
map<string, ShardMetadata> shards = 4;
}
message ClusterRequest {
}
message ClusterResponse {
map<string, Node> nodes = 1;
map<string, IndexMetadata> indexes = 2;
bytes indexer_assignment = 3 [json_name="indexer_assignment"];
bytes searcher_assignment = 4 [json_name="searcher_assignment"];
}
message CreateIndexRequest {
string index_name = 1 [json_name="index_name"];
string index_uri = 2 [json_name="index_uri"];
string lock_uri = 3 [json_name="lock_uri"];
bytes index_mapping = 4 [json_name="index_mapping"];
uint32 num_shards = 5 [json_name="num_shards"];
string default_search_field = 6 [json_name="default_search_field"];
bytes default_analyzer = 7 [json_name="default_analyzer"];
}
message CreateIndexResponse {
}
message DeleteIndexRequest {
string index_name = 1 [json_name="index_name"];
}
message DeleteIndexResponse {
}
message Document {
string id = 1;
double score = 2;
int64 timestamp = 3;
bytes fields = 4;
bytes highlights = 5;
}
message AddDocumentsRequest {
string index_name = 1 [json_name="index_name"];
string shard_name = 2 [json_name="shard_name"];
repeated Document documents = 3;
}
message AddDocumentsResponse {
}
message DeleteDocumentsRequest {
string index_name = 1 [json_name="index_name"];
string shard_name = 2 [json_name="shard_name"];
repeated string ids = 3;
}
message DeleteDocumentsResponse {
}
message AggregationRequest {
string type = 1;
bytes options = 2;
}
message AggregationResponse {
map<string, double> buckets = 1;
}
message Query {
string type = 1;
bytes options = 2;
}
message Highlighter {
string type = 1;
bytes options = 2;
}
message HighlightRequest {
Highlighter highlighter = 1;
int32 num = 2;
}
message SearchRequest {
string index_name = 1 [json_name="index_name"];
repeated string shard_names = 2 [json_name="shard_names"];
Query query = 3;
int32 start = 4;
int32 num = 5;
string sort_by = 6 [json_name="sort_by"];
repeated string fields = 7;
map<string, AggregationRequest> aggregations = 8;
map<string, HighlightRequest> highlights = 9;
}
message SearchResponse {
string index_name = 1 [json_name="index_name"];
uint64 hits = 2;
repeated Document documents = 3;
map<string, AggregationResponse> aggregations = 4;
}