1.索引创建
1.1 启动elasticsearch-head
{
"settings"
: {
"number_of_shards"
:
3
,
"number_of_replicas"
:
1
},
"mappings"
: {
"man"
: {
"properties"
: {
"name"
: {
"type"
:
"text"
},
"country"
: {
"type"
:
"keyword"
},
"age"
: {
"type"
:
"integer"
},
"date"
: {
"type"
:
"date"
,
"format"
:
"yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || epoch_millis"
}
}
},
"woman"
: {
}
}
}
|
2.插入
PUT http://localhost:9200/people/man/1
{
"name"
:
"瓦力"
,
"country"
:
"China"
,
"age"
:
30
,
"date"
:
"1987-03-07"
}
|
3.修改
POST http://localhost:9200/people/man/1/_update
{
"doc"
:{
"name"
:
"谁是瓦力"
}
}
|
4.删除
4.1 删除文档
DELETE http://127.0.0.1:9200/people/man/1
4.2 删除索引
DELETE http://127.0.0.1:9200/people