REQUEST A LIVE DEMO

Document Resource

Path : /{index name}/{type name}/{document id?}

Description:

Index a document into the search engine with the optionally specified document id. If the document contains fields called __authorized_acl_user and/or __authorized_acl_group, entitlements will be enforced. These fields should be a JSON list of user identifiers or group identifiers (respectively).

Parameters:

Name Value Description
parent string The id of the parent document.
root (or routing) string The id of the “root” document, if there is a grand-parent (or greater) document that this relates to.

Code Sample:

curl -X GET http://api.dragonglass.me/default/test-type/1 --user username:password -d ‘{“message”: “Hello world”} curl -X POST http://dragonglass.me/default/test-type/1 --user username:password -d ‘{“message”: “Hello world”} curl -X DELETE http://dragonglass.me/default/test-type/1 --user username:password

Success response code:

  • 200 for GET, PUT.
  • 204 WILL be returned for DELETE.
  • 201 WILL be returned for POST operations (if successful) with the new resource’s URL specified in the Location header.

GET Response:

{ "status": 200, , "_type": "test-type", "links": [ { "url": "http://dragonglass.me/default/test-type/1", "rel": "self" } ], "_source": { “message”: “Helloworld” } }

POST Response:

[ { "status": "success", "_type": "test-type", "job_run_id": “...jobrunid…”, “_index”: “default” } ]

DELETE Response:

{ "status": 200, "content": [ { "status": 200, "_type": "test-type", "_index": “default”, “_version”: 1, “found”: true, “_id”: 1 } ] }

Error response code:

Error Code Reason
401 You did not provide authorization credentials.
403 The credentials you provided were incorrect or not recognized.
404 The specified document does not exist.