Tuesday 27 October 2015

Elasticsearch Binary type

The binary type is a base64 representation of binary data that can be stored in the index. The field is not stored by default and not indexed at all.

Delete employee type if is there any…
DELETE /organization/employee
PUT /organization/_mapping/employee
{
 "employee":{
  "properties" : {
   "firstName" : {"type" : "string", "store" : true},
   "lastName" : {"type" : "string", "store" : true},
   "salary" : {"type" : "double", "store" : true},
   "isPermanent" : {"type" : "boolean", "store" : true},
   "joiningDate" : {"type" : "date", "format" : "yyyyMMdd"},
   "image" : {"type":"binary"}
  }
 }
}

You can check the mapping like below.
GET /organization/_mapping/employee

You will get following response
{
   "organization": {
      "mappings": {
         "employee": {
            "properties": {
               "firstName": {
                  "type": "string",
                  "store": true
               },
               "image": {
                  "type": "binary"
               },
               "isPermanent": {
                  "type": "boolean",
                  "store": true
               },
               "joiningDate": {
                  "type": "date",
                  "format": "yyyyMMdd"
               },
               "lastName": {
                  "type": "string",
                  "store": true
               },
               "salary": {
                  "type": "double",
                  "store": true
               }
            }
         }
      }
   }
}


 
Prevoius                                                 Next                                                 Home

No comments:

Post a Comment