如果只想检查一些文档是否存在,我们可以使用HEAD来替代GET方法,这样就只会返回HTTP头文件。
[hadoop@master elasticsearch-2.4.0]$ curl -i XHEAD http://master:9200/zhouls/user/1 curl: (6) Couldn't resolve host 'XHEAD' HTTP/1.1 200 OK Content-Type: application/json; charset=UTF-8 Content-Length: 112 {"_index":"zhouls","_type":"user","_id":"1","_version":1,"found":true,"_source":{"name" : "john" , "age" : 28}}[hadoop@master elasticsearch-2.4.0]$ [hadoop@master elasticsearch-2.4.0]$