es6.6.2操作索引和文檔的命令

標準的創建索引方法,這種方式是創建索引的時候,動態指定mapping映射,作用是讓索引建立得更細緻和完善:

curl -H "Content-Type:application/json" -XPUT 'http://IP地址:端口/xxx_log' -d '{"aliases" : { },"mappings" : {"dat_xxxx_log" : {"_all": {"enabled": false},"properties" : {"@timestamp" : {"type" : "date"},"@version" : {"type" : "keyword"},"oper_ip" : {"type" : "keyword"},"oper_user" : {"type" : "keyword"},"oper_time" : {"type" : "long"},"oper_type" : {"type" : "keyword"},"oper_context" : {"type" : "text","fielddata" : true}}}},"settings" : {"index" : {"codec" : "best_compression","number_of_shards" : "8","number_of_replicas" : "0","refresh_interval" : "10s","sort.field": ["oper_time"],"sort.order":["asc"]}}}'

 


查詢索引
curl -XGET 'http://IP:PORT/screen_video_index/_search?q=*&pretty'


刪除文檔
curl -XDELETE http://IP:PORT/screen_video_index/screen_video_type/ciixg2wBtxTfQOUp9tt7/

1、感覺不加雙引號也行。 2、ciixg2wBtxTfQOUp9tt7是id號


添加文檔
curl -H 'Content-Type:application/json' -XPOST 'http://IP:PORT/screen_video_index/screen_video_type' -d
'{"operate_time":"2019-08-09 08:19:08", "context":"刪除文件夾", "operate_user":"huangxiaodi"}'

添加文檔後,id是默認生成的序列號

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章