Document operationsElasticsearch
POST <index>/_doc
POST <index>/_doc
PUT <index>/_doc/<id>
Index new documents with autogenerated or explicit IDs.
Command
curl -X POST "http://:9200//_doc?pretty" -H 'Content-Type: application/json' -d '{"user":"alice","message":"hello world"}'
Example usage
Create or replace documents via REST endpoints.
curl -X POST "http://<host>:9200/<index>/_doc?pretty" -H 'Content-Type: application/json' -d '{"user":"alice","message":"hello world"}'
curl -X PUT "http://<host>:9200/<index>/_doc/<id>?pretty" -H 'Content-Type: application/json' -d '{"user":"bob","message":"updated"}'
Related tags
Document operationsPUT <index>/_doc/<id>searchobservabilityrest-api