sushant102004 / Catalog-Indexing-Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Catalog Indexing Engine

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).

Tech Stack:

  1. Go
  2. Elasticsearch

How to setup:

  1. Create a new file and name is .env
  2. Create a new deployment of Elasticsearch through elasticsearch cloud portal.
  3. Get your deployment endpoint and API Key.
  4. Add following code to .env
ElasticSearchEndpoint=<YOUR_ENDPOINT_URL>

ElasticSearchAPIKey=<YOUR_API_KEY>
  1. Run the following command go run main.go
  2. Application will automatically start the server on port 5000.

API Endpoints:

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"
}

About


Languages

Language:Go 99.7%Language:Makefile 0.3%