Skip to content

Instantly share code, notes, and snippets.

@szabizs
Last active January 23, 2023 22:14
Show Gist options
  • Save szabizs/60e87598e217bfa613ea214409f20d70 to your computer and use it in GitHub Desktop.
Save szabizs/60e87598e217bfa613ea214409f20d70 to your computer and use it in GitHub Desktop.
Index a product in Elasticsearch for an ecommerce project
curl --location --request POST 'localhost:9200/ecom/_doc/123' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Adidas NMD_R1 V3",
"description": "adasad ada das dasd asd",
"price": "154.00",
"filters": [
{
"name": "shoe_size",
"pretty_name": "Shoe size",
"value": "40",
"label": "40"
},
{
"name": "material",
"pretty_name": "Material",
"value": "Rubber",
"label": "Rubber"
},
{
"name": "color",
"pretty_name": "Color",
"value": "Navy Blue",
"label": "Navy Blue"
},
{
"name": "type",
"pretty_name": "Type",
"value": "product",
"label": "product"
},
{
"name": "brand",
"pretty_name": "Brand",
"value": "Adidas",
"label": "Adidas"
},
{
"name": "category",
"pretty_name": "Category",
"value": "Shoes",
"label": "Shoes"
}
],
"labels": [
{
"label": "New arrival",
"color": "red"
}
],
"images": [
{
"is_main": false,
"thumbnail": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/thumbnail_8a489c52-e071-46a2-b07e-3aae98fc54651672915008.jpg",
"full": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/original_0de03e7f-015b-47c2-b017-2cebd40263d01672915009.jpg"
},
{
"is_main": false,
"thumbnail": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/thumbnail_46afbdd0-b023-485c-ae3b-69e500e145ce1672915009.jpg",
"full": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/original_231afa24-d01a-47b6-bbb8-dd86aa17d41b1672915009.jpg"
},
{
"is_main": false,
"thumbnail": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/thumbnail_0e8f1c36-794a-4a5d-8f7e-99cb9ee725161672915009.jpg",
"full": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/original_12124142-fab8-43cf-b660-988579ac7f391672915009.jpg"
},
{
"is_main": false,
"thumbnail": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/thumbnail_5e0a023c-af72-45b6-af65-bc70157855f31672915009.jpg",
"full": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/original_304b3fc4-d2d8-41c3-bc78-c371405854d51672915009.jpg"
},
{
"is_main": true,
"thumbnail": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/thumbnail_4b609124-8258-4dc3-9015-5dad37df4bbd1672915009.jpg",
"full": "http:\/\/admin.apip.test\/storage\/images\/products\/1\/original_761731b4-de20-4cbd-a437-ccf45894530f1672915009.jpg"
}
]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment