Monday, April 30, 2018

Change elastic password using curl


Donghuas-MacBook-Air:bin donghua$ curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -d '{
  "password" : "elastic"   
}'
Enter host password for user 'elastic':
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}


Donghuas-MacBook-Air:bin donghua$ curl -XPUT -H 'Content-Type: application/json' -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -d '{                   
  "password" : "elastic"
}'
Enter host password for user 'elastic':

{}



Donghuas-MacBook-Air:bin donghua$ curl -XGET -u elastic:elastic localhost:9200/?pretty
{
  "name" : "0rArjNg",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "dZYuMdDkQICV_oS2-nvmpQ",
  "version" : {
    "number" : "6.2.4",
    "build_hash" : "ccec39f",
    "build_date" : "2018-04-12T20:37:28.497551Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}