使用kibana操作ES
创建索引
##1.创建索引
PUT /xuxu
创建类型 文档 字段
##3.创建(修改)文档 索引/类型/id
PUT /xuxu/user/1
{
"name":"xuxuname",
"age":20,
"sex":"男"
}
查询索引
##2.查询索引
GET /xuxu
{
"xuxu": {
"aliases": {},
"mappings": {
"user": {
"properties": {
"age": {
"type": "long"
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"sex": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
},
"settings": {
"index": {
"creation_date": "1559532698877",
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "XEKXe8RCSAq2iOg2xtJ5UA",
"version": {
"created": "6040399"
},
"provided_name": "xuxu"
}
}
}
}
查询文档数据
##4.查询文档数据
GET /xuxu/user/1
{
"_index": "xuxu",
"_type": "user",
"_id": "1",
"_version": 2,
"found": true,
"_source": {
"name": "xuxuname",
"age": 20,
"sex": "男"
}
}
其中type相当于关系型数据库中的表概念 id代表1行数据 name age sex这些json相当于字段也就是列
修改是执行put操作 会覆盖之前的记录,同时版本号会加1
删除索引
DELETE /xuxu