The purpose of this service is to be your full text search web service for JavaScript front-ends like React with fetch.
Portal is a full replacement for ElasticSearch and MeiliSearch. These services are either too complex, too resource hungry, and/or too slow.
Portal is built to be simple and fast as possible with JWT verification, indexing, deindexing, search, and suggest.
Indexing is batch indexing by default.
To use this service you need to have running sonic server and a broker server.
html
POST /index
- authenticated endpoint (Authorization: Bearer {jwt})
example:
json
{
"items": [{
"collection": "coffee",
"bucket": "tenant_1",
"id": "49e28aae-88d4-4c19-86d8-51f2c9f11039",
"data": {
"name": "roasted",
"image": "https://img.com/bucket/123/123.jpg"
},
"locale": "eng",
"indexes": ["name"]
}]
}
- note: locale
is an optional field of an ISO 639-3 locale code - if not defined locale will be auto-detected
will return: 200
or 500
or 400
or 401
html
POST /search
- authenticated endpoint (Authorization: Bearer {jwt})
json
{
"collection": "coffee",
"bucket": "tenant_1",
"query": "roasted",
"limit": 10,
"offset": 10
}
- note: limit and offset are optional fields
will return: 200
or 500
or 400
or 401
200 - will return an array of objects
json
[
{
"collection": "coffee",
"bucket": "tenant_1",
"id": "49e28aae-88d4-4c19-86d8-51f2c9f11039",
"data": {
"name": "roasted",
"image": "https://img.com/bucket/123/123.jpg"
},
"locale": "eng",
"indexes": ["name"]
}
]
html
POST /suggest
- authenticated endpoint (Authorization: Bearer {jwt})
json
{
"collection": "coffee",
"bucket": "tenant_1",
"query": "r",
"limit": 10
}
- note: limit is an optional field
will return: 200
or 500
or 400
or 401
200 - will return an array of words (strings)
json
["roasted"]
html
POST /deindex
- authenticated endpoint (Authorization: Bearer {jwt})
json
{
"ids": ["49e28aae-88d4-4c19-86d8-51f2c9f11039"]
}
will return: 200
or 500
or 400
or 401
cargo install portal
*
8888
- can only be set for unsecure connectionssecret
false
certs
db
localhost:1491
SecretPassword
http://localhost:8080
./portal --secure="true" --jwt_secret="xTJEX234$##$" --domain="index.broker.com" --sonic_server="sonic.broker.com" --sonic_password="wj34T%$Dx" --broker="https://broker.broker.com"