RESTful (PUT, GET, POST, DELETE) API equivalent to CRUD API (Create, Retrieve, Update, Delete)
curl -XVERB 'PROTOCOL://HOST:PORT/PATH?QUERY_STRING' -d 'BODY'
VERB: PUT, GET, POST, and DELETE
PUT vs POST – PUT replaces and POST append.
Create – PUT:
# curl -XPUT http://localhost:9200/Index_Name -d '{"name": "Jack", "skills": "nada"}'
Retrieve – GET:
# curl -XGET http://localhost:9200/Index_Name?pretty
Update – POST (partial) / PUT(whole):
# curl -XPOST http://localhost:9200/Index_Name/type/_update -d'
{
"doc": {
"foo" : "bar"
}
}'
Delete:
# curl -XDELETE http://localhost:9200/Index_Name
Index – Logical namespace which points to one or more shards in an ElasticSearch cluster and serves as the place to store related data.
Type – Within an index, you can define one or more types. A type is a logical category/partition of your index.
Document – Within a Type, a Document is a basic unit of information that can be indexed. For example, you can have a document for a single customer, another document for a single product, and yet another for a single order. This document is expressed in JSON format.