Sunday 25 October 2015

Elasticsearch: Boolean types


Boolean data type takes two values true or false.

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}
  }
 }
}

You can check the mapping like below.

GET /organization/_mapping/employee

Response like below.

{
   "organization": {
      "mappings": {
         "employee": {
            "properties": {
               "firstName": {
                  "type": "string",
                  "store": true
               },
               "isPermanent": {
                  "type": "boolean",
                  "store": true
               },
               "lastName": {
                  "type": "string",
                  "store": true
               },
               "salary": {
                  "type": "double",
                  "store": true
               }
            }
         }
      }
   }
}



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment