关于es7:es常用命令

3次阅读

共计 979 个字符,预计需要花费 3 分钟才能阅读完成。

es 数据结构的迁徙

   1. 命令 cmd 执行
导 mapping:
./elasticdump --input=http:// 原服务器地址 / 索引 --output=http:// 新服务器地址 / 索引 --type=mapping
    2. 导数据
导数据:./elasticdump --input=http:// 原服务器地址 / 索引 --output=http:// 新服务器地址 / 索引 --type=data
3. 备份索引数据
./elasticdump --input=http:// 备份的服务器地址 / 索引 --output=C:\Users\clyyy\Desktop\ 北京云 es\activities_mapping.json(备份的地址以及名称)--type=mapping

es 查用命令(curl 命令和控制面板殊途同归)

 -X : 指定 http 的申请形式,有 HEAD、GET、POST、PUT、DELETE
 -d : 指定要传输的数据
 -H : 指定 http 的申请头信息
 -u : 用户名
1. 依据 id 查问文章详情
    curl -XGET 'http://es 地址 / 索引 / 索引 /_search?pretty' -u elastic: 用户名  -H "Content-Type:application/json" -d '{"query": {"match": {"id":"id 值 "}},"size": 20}'
2. 新建字段
  curl -XGET 'http:// 地址 / 索引 / 索引 /_mapping?pretty' -u elastic: 用户名  -H "Content-Type:application/json" -d '{"properties":{" 字段名称 ":{"type":" 类型 "}}}
3. 依据 id 删除数据
curl -POST 'http:// 地址 / 索引 /_delete_by_query?pretty' -u elastic: 用户名  -H "Content-Type:application/json" -d '{"query":{"term":{"_id":"id 值 "} }}'
4. 删除某个索引下的所有数据(不删除索引构造)curl -POST 'http:// 地址 / 索引 /_delete_by_query?pretty' -u elastic: 用户名  -H "Content-Type:application/json" -d '{"query": {"match_all": {} }}'





正文完
 0