...
Sample Demo
Create Index
Code Block |
---|
$ curl -u"user:pass" elasticuser -H "Content-Type: application/json" -XPUT httpshttp://xxx.us-west-2.aws.found.io:9243/prasadvelocalhost:9200/engopsteam -d '{ "mappings" : { "properties" : { "id" : { "type": "long" }, "displayName" : { "type": "text" }, "userName" : { "type": "text" }, "emailAddress" : {"type": "text" }, "startDate" : {"type": "date", "format" : "yyyy-MM-dd HH:mm:ss" }, "issuesCreated" : {"type": "long"}, "issuesResolved" : {"type": "long"} } } }' Enter host password for user 'elasticuser': |
Code Block |
---|
{"acknowledged":true,"shards_acknowledged":true,"index":"engopsteam"} |
Create Documents
Code Block |
---|
curl -u"user:pass" elasticuser -H "Content-Type: application/json" -XPOST httpshttp://xxx.us-west-2.aws.found.io:9243/prasadvelocalhost:9200/engopsteam/_doc -d '{ "id" : "10001", "displayName" : "Venkat Prasad", "userName" : "prasadve", "emailAddress" : "venkat@gmailvenkat.prasad@noreply.com", "startDate" : "20172015-01-1001 0801:00:00", "issuesCreated" : "100", "issuesResolved" : "60" }' Enter host password for user 'elasticuser': |
Code Block |
---|
$ curl -u"user:pass" elasticuser -H "Content-Type: application/json" -XPOST httpshttp://xxx.us-west-2.aws.found.io:9243/prasadvelocalhost:9200/engopsteam/_doc -d '{ "id" : "1000210001", "displayName" : "PrasanthVenkat TPrasad", "userName" : "tprasanthprasadve", "emailAddress" : "z_tprasanth@gmailvenkat.prasad@noreply.com", "startDate" : "20122015-1101-1701 0801:00:00", "issuesCreated" : "100", "issuesResolved" : "60" }' {"_index":"prasadveengopsteam","_type":"people_doc","_id":"MTNZQmkBY6_cg4F9uEKjN9OD3HABKUnfGCRJZ5pa","_version":1,"result":"created","_shards":{"total":2,\ "successful":21,"failed":0},"_seq_no":01,"_primary_term":1} $ Update Document (partial update) curl -XPOST http://elkstack-serverlocalhost:80809200/prasadveengopsteam/people_doc/AVEfDHKHZteFAc4UPY0jN9OD3HABKUnfGCRJZ5pa/_update -d '{ "doc" : { "yearsExpissuesResolved": "1570" } }' |
Delete Document
Code Block |
---|
curl -XDELETE http://elkstack-server:8080/prasadve/people_doc/AVEfDHKHZteFAc4UPY0j |