FastAPI with elasticsearch on docker container
This repo contains demo code that tell you how we can use fastapi with docker and connected with elasticsearch(As a database).
Tech stack:
1.FastAPI
2.Elasticsearch
3.docker
Steps to run
-
Pull code or download the code(It is public repo)
-
If you have docker on your system then just run single command
docker-compose up --build
Note- Be ensure you are in directory where Dockerfile and yml is there.
Api endpoints for trade
-
Get trade based on trade id
URL- http://{IP}:8001/trade/{trade_id}
Method- GET
eg: trade_id = 332
-
Get list of trades
URL- http://{IP}:8001/trade/?page=1
Method- GET
-
Search on many fields (As mentioned in Assgnment)
URL- http://{IP}:8001/trade/?keyword=Banglore&page=1
Method- GET
-
Filter
http://{IP}:8001/trade/?page=1&start=2015-02-11 00:00:00&end=2016-02-11 01:12:00
Note- Please change IP(In app/es_connector.py) assigned to elastisearch container in your machine.