Learning Elastic Stack 7.0(Second Edition)
上QQ阅读APP看书,第一时间看更新

Indexing a document by providing an ID

We have already seen this version of the indexing operation. The user can provide the ID of the document using the PUT method.

The format of this request is PUT /<index>/<type>/<id>, with the JSON document as the body of the request:

PUT /catalog/_doc/1
{
"sku": "SP000001",
"title": "Elasticsearch for Hadoop",
"description": "Elasticsearch for Hadoop",
"author": "Vishal Shukla",
"ISBN": "1785288997",
"price": 26.99
}