elasticsearch常用命令

1.手动分派分片

curl -XPOST 'http://ip:httpport/_cluster/reroute' -d  '{
    "commands": [
        {
            "allocate": {
                "index": "indexName",
                "shard": shardNumber,
                "node": "target_node_name",
                "allow_primary": "false"
            }
        }
    ]
}'

 

2.手动移动分片 

curl -XPOST "http://168.7.1.67:9200/_cluster/reroute' -d  '{  
   "commands" : [{  
        "move" : {  
            "index" : "log4j-emobilelog",  
            "shard" : 0,  
            "from_node" : "es-0",  
            "to_node" : "es-3"  
        }  
    }]  
}'

 

3.动态设置es索引副本数量  

curl -XPUT 'http://ip:httpport/indexName/_settings' -d  '{
 "number_of_replicas" : 1
}'

 

4.mapping中添加字段

curl -XPUT /index/type/_mapping

{
    "properties": {
        "ivr_phone": {
            "type": "text"
        },
        "resource_shop_id": {
            "type": "long"
        }
    }
}

 

posted @ 2017-12-29 17:00  daniel456  阅读(383)  评论(0编辑  收藏  举报