Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sample Demo


Create Index
Code Block
$ curl -u"user:pass" -H "Content-Type: application/json" -XPUT https://xxx.us-west-2.aws.found.io:9243/prasadve -d '{ 
	"mappings" : { 
		"people" : {

			"properties" : { 
				"id" : { "type": "long" },
				"displayName" : { "type": "text" },
				"userName" : { "type": "text" },
				"emailAddress" : {"type": "text" },
				"startDate" : {"type": "date", "format" : "yyyy-MM-dd HH:mm:ss" } 
			} 
		}

	} 
}'
{"acknowledged":true,"shards_acknowledged":true,"index":"prasadve"}
$


Create Documents
Code Block
$ curl -u"user:pass" -H "Content-Type: application/json" -XPOST https://xxx.us-west-2.aws.found.io:9243/prasadve/people_doc -d '{
	"id" : "10001",
	"displayName" : "Venkat Prasad",
	"userName" : "prasadve",
	"emailAddress" : "venkat@gmail.com",
	"startDate" : "2017-01-10 08:00:00"
}'
{"_index":"prasadve","_type":"people","_id":"MjNcQmkBY6_cg4F9WELe","_version":1,"result":"created","_shards":{"total":2,\
"successful":2,"failed":0},"_seq_no":1,"_primary_term":1}
$


Code Block
$ curl -u"user:pass" -H "Content-Type: application/json" -XPOST https://xxx.us-west-2.aws.found.io:9243/prasadve/people_doc -d '{
	"id" : "10002",
	"displayName" : "Prasanth T",
	"userName" : "tprasanth",
	"emailAddress" : "z_tprasanth@gmail.com",
	"startDate" : "2012-11-17 08:00:00"
}'
{"_index":"prasadve","_type":"people","_id":"MTNZQmkBY6_cg4F9uEKj","_version":1,"result":"created","_shards":{"total":2,\
"successful":2,"failed":0},"_seq_no":0,"_primary_term":1}
$ 


Update Document (partial update)
curl -XPOST http://elkstack-server:8080/prasadve/people/AVEfDHKHZteFAc4UPY0j/_update -d '{
	"doc" : {
		"yearsExp": "15"
	}
}'

...