C:\Users>curl -H "Content-Type: application/json" -XGET "http://local
host:9200/logstash-pc-(2018-05-09)/_search?pretty" -d "{"query":{"match":{"MSG":
"Test3"}}}"
{
"error" : {
"root_cause" : [
{
"type" : "json_parse_exception",
"reason" : "Unexpected character ('q' (code 113)): was expecting double-
quote to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteB
ufStreamInput@3c8ad001; line: 1, column: 3]"
}
],
"type" : "json_parse_exception",
"reason" : "Unexpected character ('q' (code 113)): was expecting double-quot
e to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufSt
reamInput@3c8ad001; line: 1, column: 3]"
},
"status" : 500
}
i want to know how to write query
May be:
curl -H "Content-Type: application/json" -XGET "http://local
host:9200/logstash-pc-(2018-05-09)/_search?pretty" -d '{"query":{"match":{"MSG":
"Test3"}}}'
it can't work when i use ‘
C:\Users\chenzilong>curl -H "Content-Type: application/json" -X GET "http://localhost:9200/logstash-pc(2018-05-09)/_search?pretty" -d '{"query":{"match":{"MSG": "Test3"}}}'
{
"error" : {
"root_cause" : [
{
"type" : "json_parse_exception",
"reason" : "Unexpected character (''' (code 39)): expected a valid value
(number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.el
asticsearch.transport.netty4.ByteBufStreamInput@4a5f25fd; line: 1, column: 2]"
}
],
"type" : "json_parse_exception",
"reason" : "Unexpected character (''' (code 39)): expected a valid value (nu
mber, String, array, object, 'true', 'false' or 'null')\n at [Source: org.elasti
csearch.transport.netty4.ByteBufStreamInput@4a5f25fd; line: 1, column: 2]"
},
"status" : 500
}
On Windows, the command prompt doesn't support single quotes, use " and escape the inner ones with \"
.
curl -H "Content-Type: application/json" -XGET "http://localhost:9200/logstash-pc-(2018-05-09)/_search?pretty" -d "{\"query\":{\"match\":{\"MSG\":\"Test3\"}}}"
thank you. it work .i have never know that thing
Cool, great it helped!
I'd also suggest using Kibana dev console which makes all that easier.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.