1、elasticsearch安裝
2全肮、elasticsearch概念
3 敞咧、elasticsearch的crud、批量操作
4辜腺、elasticsearch映射mapping
5休建、elasticsearch查詢
映射
映射是創(chuàng)建索引的時(shí)候,可以預(yù)先定義字段的類型以及相關(guān)屬性
elasticsearch會(huì)根據(jù)JSON源數(shù)據(jù)的數(shù)據(jù)基礎(chǔ)類型猜測你想要的字段映射哪自。將輸入的數(shù)據(jù)轉(zhuǎn)變成可搜索的索引項(xiàng)丰包。Mapping就是根據(jù)我們自己定義的字段的數(shù)據(jù)類型,同時(shí)告訴Elasticsearch如何索引數(shù)據(jù)以及是否可以被搜索壤巷。
作用:會(huì)讓索引建立的更加細(xì)致和完善
類型:靜態(tài)映射和動(dòng)態(tài)映射
內(nèi)置類型:
文本類型: text,keyword(text會(huì)被分詞等解析瞧毙、可搜索)
數(shù)字類型:long,integer,short,byte,double,float
日期:date
bool類型:boolean
binary類型:binary
復(fù)制類型:object胧华,nested
geo類型:geo-point,geo-shape
專業(yè)類型:ip宙彪,competion
屬性:
圖片.png
PUT lagou
{
"mappings": {
"job":{
"properties":{
"title":{
"type": "text"
},
"salary_min": {
"type": "integer"
},
"city":{
"type":"keyword"
},
"company":{
"properties":{
"name":{
"type": "text"
},
"company_addr":{
"type":"text"
},
"employee_count":{
"type":"integer"
}
}
},
"publish_date":{
"type":"date",
"format":"yyyy-MM-dd"
},
"comments":{
"type": "integer"
}
}
}
}
}