欢迎光临
我们一直在努力

工作中常用Elasticsearch命令汇总

①查询所有索引:curl -X GET "http://192.168.1.***:9200/_cat/indices?v"

②查看该索引下的字段映射(所有字段信息):

curl -X GET "http://192.168.1.***:9200/wk_single_receivables/_mapping?pretty"

③查询该索引下的所有数据

curl -X GET "http://192.168.1.***:9200/wk_single_receivables/_search?pretty" -H "Content-Type: application/json" -d '{
  "size": 1000,
  "query": {
    "match_all": {}
  }
}'

④指定索引及id查看详情:

curl -X GET "http://192.168.1.***:9200/wk_single_receivables/_doc/8?pretty"

⑤给ES索引添加字段信息:

curl -X PUT "http://192.168.1.***:9200/wk_single_receivables/_mapping/_doc?pretty" -H "Content-Type: application/json" -d '{
  "properties": {
    "contractType": {
      "type": "integer",
      "index": true
    }
  }
}'

⑥根据id更新数据:
curl -X POST "http://192.168.1.***:9200/wk_single_receivables/_doc/6/_update?pretty" -H "Content-Type: application/json" -d '{
  "doc": {
    "contractType": 1
  }
}'

赞(0)
未经允许不得转载:171主机测评 » 工作中常用Elasticsearch命令汇总
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址