The base url is the url of the API gateway and is emitted on installation via CDK.
Example
https://<api-id>.execute-api.us-east-1.amazonaws.com/prod
POST /index/{index_id}
Indexes a document so that the document is searchable.
A document can optionally provide an __id
field to set the document id.
If no __id
is provided one is generated and returned.
Indexing a document with an __id
will upsert any previously indexed data with the provided __id
.
__id
- (optional) the document id to use for the document
Basic Indexing
Request:
http https://<api-id>.execute-api.us-east-1.amazonaws.com/prod/index/book-index-1 \
author="Robert M. Pirsig" \
title="Zen and the Art of Motorcycle Maintenance"
Response:
{
"__id": "b7c8aee4-9656-47a3-8217-df1b71056a83",
"updated_at": "2022-11-14T21:17:58.824791120+00:00"
}
Providing an \_\_id
Request:
http https://<api-id>.execute-api.us-east-1.amazonaws.com/prod/index/book-index-1 \
author="Robert M. Pirsig" \
title="Zen and the Art of Motorcycle Maintenance" \
__id=zen
Response:
{
"__id": "zen",
"updated_at": "2022-11-14T21:17:58.824791120+00:00"
}
POST /index/{index_id}/query
Query an index with a provided search string.
query
- a query string to search against the index
Simple Full Text Search
Request:
http https://<api-id>.execute-api.us-east-1.amazonaws.com/prod/index/book-index-1/query \
query="zen art"
Response:
{
"matches": [
{
"doc": {
"__id": "ebf5c0a0-ca14-4471-bc21-5259d7898df3",
"title": "Zen and the Art of Motorcycle Maintenance"
},
"score": 0.57536423,
"snippets": {
"title": "<b>Zen</b> and the <b>Art</b> of Motorcycle Maintenance"
}
}
]
}
DELETE /index/{index_id}/doc/{doc_id}
Delete a document from an index such that it is no longer searchable.
Simple Full Text Search
Request:
http DELETE https://<api-id>.execute-api.us-east-1.amazonaws.com/prod/index/book-index-1/doc/b7c8aee4-9656-47a3-8217-df1b71056a83
Response:
{
"__id": "b7c8aee4-9656-47a3-8217-df1b71056a83",
"deleted_at": "2022-11-14T21:30:04.845814727+00:00"
}