我已将以下JSON文档插入ElasticSearch。
{
"AppName": "undefined",
"CPUs": 8,
"Errors": 0,
"Forms": 2,
"Group": "Unknown",
"Language": "en-GB",
"UserName": "user.name",
"msgType": "234",
"bent": "{
\"ActiveT\": 6,
\"ErrorM\": \"None\",
\"Except\": \"None\",
\"HadErr\": \"false\",
\"HM\": 62,
\"NHM\": 57,
\"Parameter\": \"14331232706\",
\"ReturnCode\": \"3050\",
\"Severity\": \"info\",
\"Timestamp\": \"Tue July0209: 58: 16NZST2015\",
\"TId\": \"9891319709\",
\"UserInfo\": \"Unknown\",
}"
}
我希望能够使用嵌套在里面的字段来绘制图形,例如HM
,NHM
,ActiveT
等。我在弹性搜索中的结构如下。
my_indes/my_doc_type/info_id
上面给出的信息是JSON文档。我使用下面的映射来映射嵌套的JSON结构bent
。
curl -XPOST localhost:9200/my_index/my_doc_type/_mapping?pretty -d '{
"events":{
"_timestamp" : {
"enabled" : true,
"store" : true,
"path" : "post_date",
"format" : "yyyy-MM-dd HH:mm:ss"
},
"properties" : {
"CPUs" : {
"type" : "long",
"index": "not_analyzed"
},
"Language" : {
"type" : "string",
"index": "not_analyzed"
},
"User" : {
"type" : "string",
"index": "not_analyzed"
},
"Forms" : {
"type" : "long",
"index": "not_analyzed"
},
"Errors" : {
"type" : "long",
"index": "not_analyzed"
},
"be_event" : {
"type" : "nested",
"properties" : {
"ActiveT" : {
"type" : "long",
"index" : "not_analyzed"
},
}
}
}
}
我收到以下错误。
"error" : "ElasticsearchParseException[Failed to parse content to map]; nested: JsonParseException[Unexpected character ('\"' (code 34)): was expecting comma to separate OBJECT entries\n at [Source: org.elasticsearch.common.compress.lzf.LZFCompressedStreamInput@c2f1e8d; line: 122, column: 19]]; ",
"status" : 400
我正在使用的映射有什么问题?