mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-24 08:25:31 +00:00
Search API (#350)
This commit is contained in:
@@ -1,20 +1,87 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
package search;
|
||||
|
||||
option go_package = "./proto;search";
|
||||
|
||||
service Search {
|
||||
rpc Vote(VoteRequest) returns (VoteResponse) {}
|
||||
// TODO reinstate when we have a reason for more fine grained control of index creation, for now just rely on lazy creation on first index call
|
||||
// rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse) {}
|
||||
|
||||
rpc Index(IndexRequest) returns (IndexResponse) {}
|
||||
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
|
||||
rpc Search(SearchRequest) returns (SearchResponse) {}
|
||||
rpc DeleteIndex(DeleteIndexRequest) returns (DeleteIndexResponse) {}
|
||||
|
||||
}
|
||||
|
||||
// Vote to have the Search api launched faster!
|
||||
message VoteRequest {
|
||||
// optional message
|
||||
string message = 1;
|
||||
// Index a document i.e. insert a document to search for.
|
||||
message IndexRequest {
|
||||
// The document to index
|
||||
Document document = 1;
|
||||
// The index this document belongs to
|
||||
string index = 2;
|
||||
|
||||
}
|
||||
|
||||
message VoteResponse {
|
||||
// response message
|
||||
string message = 2;
|
||||
message Document {
|
||||
// The ID for this document. If blank, one will be generated
|
||||
string id = 1;
|
||||
// The JSON contents of the document
|
||||
google.protobuf.Struct contents = 2;
|
||||
}
|
||||
|
||||
message IndexResponse {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// Delete a document given its ID
|
||||
message DeleteRequest {
|
||||
// The ID of the document to delete
|
||||
string id = 1;
|
||||
// The index the document belongs to
|
||||
string index = 2;
|
||||
}
|
||||
|
||||
message DeleteResponse {}
|
||||
|
||||
// Search for documents in a given in index
|
||||
message SearchRequest {
|
||||
// The index the document belongs to
|
||||
string index = 1;
|
||||
|
||||
// The query. See docs for query language examples
|
||||
string query = 2;
|
||||
}
|
||||
|
||||
message SearchResponse {
|
||||
// The matching documents
|
||||
repeated Document documents = 1;
|
||||
|
||||
}
|
||||
|
||||
// Create a search index by specifying which fields are to be queried
|
||||
message CreateIndexRequest {
|
||||
// the name of the index
|
||||
string index = 1;
|
||||
repeated Field fields = 2;
|
||||
}
|
||||
|
||||
message Field {
|
||||
// The name of the field. Use a `.` separator to define nested fields e.g. foo.bar
|
||||
string name = 1;
|
||||
// The type of the field - string, number
|
||||
string type = 2;
|
||||
}
|
||||
|
||||
message CreateIndexResponse {}
|
||||
|
||||
// Delete an index.
|
||||
message DeleteIndexRequest {
|
||||
// The name of the index to delete
|
||||
string index = 1;
|
||||
}
|
||||
|
||||
message DeleteIndexResponse {}
|
||||
|
||||
Reference in New Issue
Block a user