curl -d

curl命令模拟json格式的post请求

例如:curl -H “Content-Type:application/json” -X POST –data ‘[{“index”:[“*”],”preference”:”1503652289983”,”ignore_unavailable”:”true”},{“sort”:[{“timestamp”:{“order”:”desc”}}],”query”:{“must_not”:[],”bool”:{“must”:[{“query_string”:{“query”:”cluster”}},{“range”:{“timestamp”:{“gte”:”1503667558137”,”lte”:”1503667558137”}}}]}},”from”:”0”,”size”:”500”,”version”:”true”}]’ http://212.35.247.184:18080/

result=curl -s -u 'user':'pass' -XGET "http://192.168.13.70:9200/XXX" -H 'Content-Type: application/json' -d '{"size":10000,"query":{"bool":{"must":[{"range":{"status":{"gte":500,"lte":600}}},{"range":{"@timestamp":{"gte":"now-1h","lte":"now","format":"epoch_millis"}}}]}}}'

json串内层参数需要符合json格式规范

你可能感兴趣的:(curl)