【基本方法】
1.创建索引
PUT index1
PUT index3
{
“mappings”: {
“properties”: {
“book_id”:{
“type”: “long”
},
“book_name”: {
“type”: “text”
},
“book_author”: {
“type”: “keyword”
},
“book_price”: {
“type”: “float”
},
“book_desc”: {
“type”: “text”
}
}
}
}
索引是一个逻辑单元,es中的数据是存在分片中的
PUT index2
{
“settings”: {
“number_of_shards”: 2
}
}
2.查询索引, GET
GET index1
GET index2
GET index3
GET index2/_mapping
GET index2/_settings