我是 Elasticsearch 的新手,并试图在弹性索引中添加文档。我在这里对 PUT 和 POST 感到困惑,因为它们在以下场景中产生相同的结果:
curl -H "Content-Type: application/json" -XPUT "localhost:9200/products/mobiles/1?pretty" -d"
{
"name": "iPhone 7",
"camera": "12MP",
"storage": "256GB",
"display": "4.7inch",
"battery": "1,960mAh",
"reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"]
}
"
对比
curl -H "Content-Type: application/json" -XPOST "localhost:9200/products/mobiles/1?pretty" -d"
{
"name": "iPhone 7",
"camera": "12MP",
"storage": "256GB",
"display": "4.7inch",
"battery": "1,960mAh",
"reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"]
}
"
最佳答案
关于elasticsearch - 在 Elasticsearch 中添加文档时 PUT 与 POST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56766688/