We will be reading data from Postgres and loading it to Elasticsearch using a script.
Go to any browser, in search bar and enter 127.0.0.1:9200 to check elasticsearch service, enter 127.0.0.1:5601 to check kibana service.
In Kibana, go to Dev Tools page, paste the below command and run.
PUT /_index_template/products_template
{
"index_patterns": [
"product_*"
],
"template": {
"mappings": {
"dynamic": "strict",
"properties": {
"productId": {
"type": "text"
},
"productCategory": {
"type": "text"
},
"OrderStats": {
"type": "object",
"properties": {
"orderCount": {
"type": "integer"
},
"minPrice": {
"type": "float"
},
"maxPrice": {
"type": "float"
}
}
}
}
}
}
}
ENV POSTGRES_HOST='127.0.0.1'
ENV ES_HOST='127.0.0.1'
For the above lines, replace '127.0.0.1' with your local system ip
Build image
cd Search-Workshop2
docker build -t "ws2_es_script" .
docker run -it ws2_es_script:latest bash
python3 app.py