Elasticsearch(索引操作

查看集群状态

GET _cluster/health
http://192.168.1.200:9200/_cluster/health (GET)

{
    "cluster_name": "cluster-es-node", #节点名称
    "status": "green", //状态 (三个状态 grenn 标识正长工作 yellow 表示有警告 为分配的 或其他 red 表示不用)
    "timed_out": false, #是否超时
    "number_of_nodes": 1, #
    "number_of_data_nodes": 1,
    "active_primary_shards": 0, #真时可用的分片
    "active_shards": 0, #激活的分片数
    "relocating_shards": 0,
    "initializing_shards": 0,
    "unassigned_shards": 0, #为分配的分片
    "delayed_unassigned_shards": 0,
    "number_of_pending_tasks": 0,
    "number_of_in_flight_fetch": 0,
    "task_max_waiting_in_queue_millis": 0,
    "active_shards_percent_as_number": 100.0
}

索引操作

1.添加索引
put 请求
http://192.168.1.200:9200/index_temp
index_temp(索引名称)
josn参数
{
"settings":{
"index":
{
"number_of_shards":"2", //主 分片数
"number_of_replicas":"0" //备份分片数
}
}
}

返回信息
{
    "acknowledged": true,
    "shards_acknowledged": true,
    "index": "index_temp"
} 代表创建成功

2.查询索引接口
http://192.168.1.200:9200/index_temp (GET)

返回
{
    "index_temp": {
        "aliases": {}, (别名)
        "mappings": {}, (数据类型)
        "settings": {
            "index": {
                "creation_date": "1586669227509", (创建时间
                "number_of_shards": "2", (主分片)
                "number_of_replicas": "0", (备份分片
                "uuid": "oIz2uXxYTSKE4l7J4epsrA", (udid
                "version": {
                    "created": "7060299" (版本
                },
                "provided_name": "index_temp" (索引名称)
            }
        }
    }
}

3.删除索引
http://192.168.1.200:9200/index_temp (DELETE)请求

再次查看被删除

查询所有

猜你喜欢

转载自www.cnblogs.com/loujiang/p/12684913.html