1、查询有哪些索引
GET _cat/indices
2、创建索引同时定义映射
PUT /tb_student
PUT /tb_student
{
"mappings": {
"properties": {
"studentId" : {
"type": "keyword"
},
"userName": {
"type": "text",
"analyzer": "ik_smart"
},
"hobby": {
"type": "text",
"analyzer": "ik_max_word"
},
"gender": {
"type": "keyword"
},
"age": {
"type": "integer"
},
"className": {
"type": "keyword"
},
"createTime" : {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
3、删除索引
DELETE /tb_student
4、查看索引信息
GET /tb_student
5、添加一条记录到索引中
PUT /tb_student/_doc/1
{
"userId": 1,
"userName": "李玉坤",
"gender": "男",
"age": 18,
"className": "一年级2班",
"hobby": "打羽毛球,打蓝球,游泳",
"createTime": "2024-01-13 11:12:22"
}
6、查询所有记录
GET /tb_student/_search
{
"query": {
"match_all": {}
}
}