1、查询task
curl -XGET "localhost:9210/_tasks?detailed=true&actions=*/delete/byquery&pretty"
2、取消task
curl -X POST "localhost:9210/_tasks/3E8fPHtLT42O8p16b4cqrA:1863557501/_cancel"
3、取消只读
curl -XPUT -H "Content-Type: application/json" http://localhost:9210/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
4、查看索引
curl -XGET localhost:9210/_cat/indices?v |grep pre
5、删除数据
curl -XPOST "localhost:9210/online_segment/_delete_by_query?scroll_size=10000&pretty&slices=11" -H 'Content-Type: application/json' -d'{"query": {"range": {"end_time" : {"lte":1562450554000}}}}'
6、允许单节点分片数
curl -X PUT "localhost:9210/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"persistent" : {
"cluster.max_shards_per_node" : "30000"
}
}
'
7、查看pending的task
curl -XGET localhost:9210/_cluster/pending_tasks
8、删除索引
curl -XDELETE http://127.0.0.1:9210/online*20190708?master_timeout=60s
9、改变设置,比如副本数
curl -X PUT "localhost:9210/_template/pre-us_instance_clr_gen0_collect_count_month-*" -H 'Content-Type: application/json' -d'
{
"index_patterns" : ["*"],
"settings" : {
"number_of_shards" : 1
}
}
'
10、删除mapping
curl -X DELETE "localhost:9210/_template/pre*"
11、排除node,取消把node_name设置为null
curl -X PUT "localhost:9210/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'
{
"transient":{
"cluster.routing.allocation.exclude._name" : "node_name"
}
}
'
12、查看节点分片
curl -XGET localhost:9210/_cat/shards |grep node_name
13、查看节点
curl -XGET localhost:9210/_cat/nodes
14、查询数据
curl -XPOST 'localhost:9210/daily_network_address_inventory/_search?pretty' -H 'Content-Type: application/json' -d'
{
"size": 1,
"query": {
"match_all": {}
}
}'
15、索引复制
curl -XPOST 'http://127.0.0.1:9210/_reindex?pretty' -d '{
"conflicts": "proceed",
"source": {
"index": "pre_zh_register_lock"
},
"dest": {
"index": "zh_pre_register_lock",
"version_type": "external"
}
}' -H 'Content-Type:application/json'
16、查看mapping属性
curl localhost:9210/pre_zh_endpoint_inventory/_mappings?pretty
17、更新字段值
curl -XPOST 'localhost:9210/zh_pre_service_instance_inventory/_update_by_query?pretty' -H 'Content-Type: application/json' -d'{
"script":{
"source":"ctx._source.last_update_time=1576736982"
},
"query":{"match_all":{}
}
}'
18、数据复制工具taskrabbit
docker run --net=host --rm -i \
--volume /tmp:/home/docker \
taskrabbit/elasticsearch-dump \
--input=/home/docker/data_00.json \
--output=http://localhost:9210/us_pre_register_lock \
--type=data \
--maxSockets=10 \
--limit=10000
19、分片禁止取消
curl -X PUT "localhost:9210/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"persistent": {
"cluster": {
"routing": {
"allocation.enable": null
}
}
}
}
'
20、集群状态
curl localhost:9210/_cluster/health?pretty
21、动态变更参数
curl -XPOST 'http://localhost:9210/_all/_close'
curl -XPUT -H "Content-Type: application/json" http://localhost:9210/_all/_settings -d '{"index.merge.scheduler.max_thread_count": "1","index.refresh_interval": "30s","index.translog.durability": "async","index.translog.sync_interval": "120s"
}'
curl -XPOST 'http://localhost:9210/_all/_open'