restful 风格操作es
| method | url地址 | 描述 |
|---|---|---|
| PUT | host:port/索引名/类型名/文档ID | 创建文档(指定文档ID) |
| POST | host:port/索引名/类型名 | 创建文档(随机文档ID) |
| POST | host:port/索引名/类型名/文档ID/_update | 修改文档 |
| POST | host:port/索引名/类型名/文档ID/_search | 查询数据 |
| DELETE | host:port/索引名[/类型名][/文档ID] | 删除文档 |
| GET | host:port/索引名/类型名/文档ID | 通过文档ID查询文档 |
类型:_doc
PUT
创建一个文档
PUT /test/_doc/doc1
{
"name":"test"
}
更新文档
PUT /test/_doc/doc1
{
"name":"更新测试"
}
指定数据类型创建索引
| 数据类型 | 关键字 |
|---|---|
| 字符串 | text keyword(不可分词) |
| 数值 | long integer short byte double float (half float) (scaled float) |
| 日期 | date |
| 布尔 | boolean |
PUT /test1
{
"mappings" : {
"properties" : {
"name" : {
"type" : "keyword"
}
}
}
}
GET
获取索引信息
GET test1
获取健康值
GET _cat/health
GET _cat/indices?v
POST
更新文档
POST /test/_doc/doc1/_update
{
"doc" : {
"name":"更新1测试"
}
}

