将封闭的引号从更改为后,请对参数内部使用的引号
'进行
"转义
",如下所示:
curl -XGET gitlab.server:9200/ -H "Content-Type: application/json" -d "{"query": {"simple_query_string" : {"fields" : ["content"], "query" : "foo bar -baz"}}}"另一种选择是将json放入文件中,并使用
@前缀作为参数。
json.txt
{ "query": { "simple_query_string" : { "fields" : ["content"], "query" : "foo bar -baz" } }}并如下运行curl:
curl -XGET gitlab.server:9200/ -H "Content-Type: application/json" -d @json.txt



