POST /index_test/www/_mapping
{"properties":{"content":{"type":"text","fields":{"keyword":{"type":"text","analyzer":"key_analyzer"},"sortword":{"type":"keyword"}},"analyzer":"text_analyzer"}}}
es开启慢查询日志
PUT /_cluster/settings
{"transient":{"logger.discovery":"DEBUG"}}
8. 索引增加/删除别名
增加别名
POST /_aliases
{"actions":[{"add":{"index":"test_search_index","alias":"my_index_alias"}}]}
删除别名
POST /_aliases
{"actions":[{"remove":{"index":"test_send_lms","alias":"MC_test317_test_index"}}]}
更新文档
POST /test_201803/mail/6538317985629667366/_update
{"doc":{"m_acc":"mailtest@qq.com"}}
脚本更新
PUT test/type1/1{"counter":1,"_counter_conf":10,"tags":["red"],"_tags_conf":10}
POST test/type1/1/_update
{"script":{"inline":"ctx._source.counter += params.count","lang":"painless","params":{"count":4}}}
POST test/type1/1/_update
{"script":{"inline":"ctx._source.tags.add(params.tag)","lang":"painless","params":{"tag":""}}}
POST test/type1/1/_update
{"script":"ctx._source.new_field = \"value_of_new_field\""}
POST test_scripts/t_vitualacc/all_3941749185576961,1ilhw9tu0z7_EBANK_ALIPAY/_update
{"script":{"inline":"if(ctx._source.type_conf<params.type_conf){ctx._source.type=params.type;ctx._source.type_conf=params.type_conf} if(ctx._source.id_conf<params.id_conf){ctx._source.id = params.id;ctx._source.id_conf=params.id_conf} if(ctx._source.account_conf<params.account_conf){ctx._source.account=params.account;ctx._source.account_conf=params.account_conf}","lang":"painless","params":{"account_conf":11,"account":"1ilhw9tu0z7777","type_conf":10,"id_conf":10}}}
设置快照库
设置快照库
PUT _snapshot/share_data
{"type":"fs","settings":{"location":"/home/esdata/share_data"}}
POST _snapshot/share_data/snapshot_2/_restore
索引状态管理
Clear Cache 清理缓存
POST /twitter/_cache/clear
默认会清理所有缓存,可指定清理query, fielddata or request 缓存
POST /kimchy,elasticsearch/_cache/clear
POST /_cache/clear
Refresh,重新打开读取索引
POST /kimchy,elasticsearch/_refresh
POST /_refresh
Flush,将缓存在内存中的索引数据刷新到持久存储中
POST twitter/_flush
Force merge 强制段合并
POST /kimchy/_forcemerge?only_expunge_deletes=false&max_num_segments=100&flush=true