Currently i am working on elastic search for my project. I need to display my records(latest first). i am using sort technique.
"sort" => array(array('created_date' => 'desc')),
and my mapping everything in string. `"products":{
"properties":{
"add_by":{
"type":"string"
},
"categories":{
"properties":{
"category_name":{
"type":"string"
},
"id":{
"type":"string"
}
}
},
"company_logo":{
"type":"string"
},
"company_name":{
"type":"string"
},
"created_date":{
"type":"string"
},
"id":{
"type":"string"
},
"industries":{
"properties":{
"id":{
"type":"string"
},
"industry_name":{
"type":"string"
}
}
},
"location":{
"type":"string"
},
"location_latitude":{
"type":"string"
},
"location_longitude":{
"type":"string"
},
"num_of_employees":{
"type":"string"
},
"practice_areas":{
"properties":{
"id":{
"type":"string"
},
"practice_area_image":{
"type":"string"
},
"practice_area_name":{
"type":"string"
}
}
},
"product_description":{
"type":"string"
},
"product_image":{
"type":"string"
},
"product_name":{
"type":"string"
},
"product_rating":{
"type":"string"
},
"status":{
"type":"string"
},
"updated_date":{
"type":"string"
},
"user_id":{
"type":"string"
},
"user_sub_type":{
"type":"string"
},
"user_type":{
"type":"string"
}
}
}` i think i might me update my mapping like id and created_date(both are update to integer and timestamp). Please help me how to update mapping for my-type(product).
->Which elasticsearch version you are running?
->Latest version doesn't support Updating mapping type.
->If you want to change mapping,you need to create new index with new mapping and copy data from old index to new index
->Another Process:insert new field with new mapping and use copy_to in mappings.
example:
'id' => [
'type' => 'string',
'copy_to' => 'combined'
],
'newid' => [
'type' => 'integer',
],
'created_at' => [
'type' => 'string',
'copy_to' => 'date'
],
'date' => [
'type' => 'date',
'format' => 'yyyy-MM-dd HH:mm:ss',
],