ElasticSearch es笔记

282 阅读1分钟


-- 数据查询 

curl -XGET IP:PORT/your_index/your_type/_search -d '{ "sort":[{ "date":{"order":"desc"}}], "size": 10 }' 

 -- 删除老数据 

curl -XPOST IP:PORT/your_index/your_type/_delete_by_query -d '{"query":{"range":{"date":{"lt":"now-30d"}}}}' 

 --切换索引 

curl -XPOST IP:PORT/_aliases -d ' { "actions": [ { "remove": { "alias": "your_alias", "index": "your_index_1" }}, { "add": { "alias": "your_alias", "index": "your_index_2" }} ] } ' 

三十天前时间:now-30d