ES 初学 1

yydssc / 2023-07-24 / 原文

GET _search
{
"query": {
"match_all": {}
}
}

创建索引

PUT person

PUT person2

删除索引

DELETE person2

查询索引

GET person2

GET person

添加映射

PUT /person/_mapping
{
"properties":{
"name":{
"type": "text"
},
"age":{
"type": "integer"
}
}
}

GET person/_mapping

添加字段

PUT /person/_mapping
{
"properties":{
"address":{
"type": "text"
}
}
}

添加文档

POST /person/_doc/1
{
"name":"zhangsan",
"age":18,
"addres":"北京"
}

查询文档

GET /person/_doc/1

添加文档不指定id

POST /person/_doc
{
"name":"李四",
"age":"83",
"address":"北京天安门"
}

查询所有文档

GET /person/_search

删除指定id 的文档

DELETE /person/_doc/1