1
我使用Powershell(通過Cmder)和curl
(GoW)在elasticsearch中創建索引模板。創建索引模板時JSON解析異常
這裏是我的捲髮:
curl -XPUT http://myAddress:9200/_template/logstash_per_iis -u user:password -d'
{
"template" : "logstash*",
"mappings" : {
"iis" : {
"properties" : {
"response":{"type":"int"},
"site":{"type":"ip"},
"supresponse":{"type":"int"},
"time_taken":{"type":"int"},
"clientHost":{"type":"ip"},
"port":{"type":"int"},
"scstatus":{"type":"int"}
}
}
}
}
'
下面是從ES響應:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "failed to parse template source"
}
],
"type": "illegal_argument_exception",
"reason": "failed to parse template source",
"caused_by": {
"type": "json_parse_exception",
"reason": "Unrecognized token 'logstash': was expecting ('true', 'false' or 'null')\n at [Source: [[email protected]; line: 3, column: 25]"
}
},
"status": 400
}
ES是說明一個json_parse_exception
,但是,我想不出在我的JSON包是無效的。
我的JSON有什麼問題,或者我做了其他不正確的事情?
這很奇怪,我可以在ES 1.x和ES 2.x集羣上執行精確的curl命令(在用'localhost'替換'myAddress'後),沒有任何問題(在MacOS上)。 – Val
@Val,我應該更清楚地注意到我在windows上。看起來答案是我需要的「」「vs」。儘管感謝你的時間。非常感激。 –
沒有問題,我會留下我對Mac問題的意見,登陸這個問題;) – Val