Elasticsearch Bulk import.
I need to import the Products as individual items.
I have a json file that looks similar to the following:
{
"Products":[
{
"Title":"Product 1",
"Description":"Product 1 Description",
"Size":"Small",
"Location":[
{
"url":"website.com",
"price":"9.99",
"anchor":"Prodcut 1"
}
],
"Images":[
{
"url":"product1.jpg"
}
],
"Slug":"prodcut1"
},
{
"Title":"Product 2",
"Description":"Prodcut 2 Desctiption",
"Size":"large",
"Location":[
{
"url":"website2.com",
"price":"99.94",
"anchor":"Product 2"
},
{
"url":"website3.com",
"price":"79.95",
"anchor":"discount product 2"
}
],
"Images":[
{
"url":"image.jpg"
},
{
"url":"image2.jpg"
}
],
"Slug":"product2"
}
]
}
I've tried the following (I'm a novice at this):
curl -s -XPOST 'http://localhost:9200/_bulk' --data-binary @products.json
curl -s -XPOST 'http://localhost:9200/_bulk' -d @products.json
curl -XPOST http://localhost:9200/cp/products -d "@products.json"
curl -XPOST http://localhost:9200/products -d "@products.json"
Some gave an error others didn't. What do I need to do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…