Elasticsearch (index operation

View cluster status

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

{
    "cluster_name": "cluster-es-node",
    #node name "status": "green", // status (three status grenn marks are working long and yellow means there are warnings for allocation or other red means no use)
    " timed_out ": false, #Whether to timeout
    " number_of_nodes ": 1, #
    " number_of_data_nodes ": 1,
    " active_primary_shards ": 0, #active shards available when
    active" active_shards ": 0, #active shards
    " relocating_shards ": 0,
    "initializing_shards": 0,
    "unassigned_shards": 0, # is the allocated     shard "
    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
}

Index operation

1. Add index
put request
http://192.168.1.200:9200/index_temp
index_temp (index name)
josn parameter
{
"settings": {
"index":
{
"number_of_shards": "2", // number of main shards
" number_of_replicas ":" 0 "// Number of backup shards
}
}
}

Return information
{
    "acknowledged": true,
    "shards_acknowledged": true,
    "index": "index_temp"
} means successful creation

2. Query index interface
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"(Index name) }     }         }
            }


3. Delete the index
http://192.168.1.200:9200/index_temp (DELETE) request

to view the deleted again

Query all

Guess you like

Origin www.cnblogs.com/loujiang/p/12684913.html