2
假定以下文檔將被插入到Elasticsearch中。動態模板:以普通字符串存儲對象
{
"message": "hello",
"request": {
"body": {
"data": "hi",
"some_what_dynamic": {
"nested": {
"not_ending": 10000
}
}
}
}
}
鑑於場request.body
是已經嵌套在對象和/或領域的動態對象,我想存儲整個request.body
爲string
,我不想Elasticsearch創建內部request.body
對象特性的新領域。
如何定義映射來實現這一目標?
這裏的電流dynamic_templates定義:
{
"template": "logstash-*",
"mappings": {
"_default_": {
"dynamic_templates": [
{
"message_field": {
"path_match": "message",
"mapping": {
"norms": false,
"type": "text"
},
"match_mapping_type": "string"
}
},
{
"string_fields": {
"mapping": {
"norms": false,
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"match_mapping_type": "string",
"match": "*"
}
},
{
"body_fields": {
"match": "body",
"mapping": {
"norms": false,
"type": "text"
},
"match_mapping_type": "object"
}
}
],
...
}
}
}
當我嘗試插入文檔中,我得到了MapperParsingException
有消息Can't get text on a START_OBJECT at...
。