A simple and customizable Catalog Indexing Engine that can index catalog data and search through data at very high speed. Supports both structured and unstructured queries (will be added in upcoming days).
- Create a new file and name is
.env
- Create a new deployment of Elasticsearch through elasticsearch cloud portal.
- Get your deployment endpoint and API Key.
- Add following code to
.env
ElasticSearchEndpoint=<YOUR_ENDPOINT_URL>
ElasticSearchAPIKey=<YOUR_API_KEY>
- Run the following command
go run main.go
- Application will automatically start the server on port 5000.
1. Index Catalog Data:
localhost:5000/index-data
Method: POST
Request Body: You can also index any data according to you. Below is just and example.
{
"name" : "Bread",
"item_type" : "Grocery",
"price" : 10,
"category" : "Bakery",
"quantity" : 20,
"measuring_unit" : "Packets"
}
2. Search Catalog Data:
localhost:5000/search
Method: GET
Request Body: Currently it only support structured query. Unstructured query support will be added in few days.
{
"query": {
"bool": {
"must": [
{ "match": { "name": "Bread" } },
{ "match": { "quantity": 20 } }
]
}
}
}
Response:
{
"data": [
{
"category": "Bakery",
"item_type": "Grocery",
"measuring_unit": "Packets",
"name": "Bread",
"price": 10,
"quantity": 20
}
],
"message": "Search Successfull"
}