李玉志 2020-07-04
集群的运行状况
GET /_cat/health?v
获取集群中的节点列表
GET /_cat/nodes?v
列出所有索引
GET /_cat/indices?v
创建索引 指定参数
PUT twitter { "settings" : { "index" : { "number_of_shards" : 3, "number_of_replicas" : 2 } } }
PUT test { "settings" : { "number_of_shards" : 1 }, "mappings" : { "_doc" : { "properties" : { "field1" : { "type" : "text" } } } } }删除索引DELETE /goods创建文档
put /customer/_doc/1?pretty
{
"name":"hahh",
"age":10
}
POST /customer/_doc
{
"list":"uyuu",
"age":23
}
查询文档
GET /customer/_doc/1?pretty
修改文档
PUT /customer/_doc/1
{
"age":56
}
POST /customer/_doc/1/_update
{
"doc":{
"name":"name"
}
}
删除文档
DELETE /customer/_doc/1?pretty
批量添加
POST /customer/_doc/_bulk
{"index":{"_id":3}}
{"name":"lilin"}
{"index":{"_id":4}}
{"name":"limen"}
批量修改和删除
POST /customer/_doc/_bulk
{"update":{"_id":3}}
{"doc":{"name":"lilin123"}}
{"delete":{"_id":4}}
批量获取多条数据
GET /customer/_doc/_mget
{
"ids":[1,2,3]
}
搜索
POST /customer/_doc/_bulk
{"index":{"_id":1}}
{"name":"lilan","age":10,"sex":1}
{"index":{"_id":2}}
{"name":"huandan","age":11,"sex":2}
{"index":{"_id":3}}
{"name":"miaomiao","age":12,"sex":1}
搜索所有
GET /customer/_doc/_search
通过名字带 miaomiao 的
get /customer/_doc/_search?q=name:miaomiao
查询所有
GET /customer/_doc/_search
{
"query":{
"match_all":{}
}
}
另外一部分,则需要先做聚类、分类处理,将聚合出的分类结果存入ES集群的聚类索引中。数据处理层的聚合结果存入ES中的指定索引,同时将每个聚合主题相关的数据存入每个document下面的某个field下。