0
我目前正在努力簡化Elasticsearch的映射模板文件。事實上,我有幾個Object
字段具有相同的結構(例如源和目標)Elasticsearch動態模板匹配幾個確切的字段
有沒有辦法設置動態模板,以便它可以匹配多個模式?
這是我執行:
POST /_template/mapping-lol
{
"template": "*-newevents-*",
"mappings": {
"log": {
"dynamic_templates": [
{
"system": {
"match_pattern": "regex",
"match": "^(source|destination)$",
"mapping": {
"properties": {
"name": {
"dynamic": false,
"type": "object",
"properties": {
"first": {
"type": "text"
},
"last": {
"type": "text"
}
}
},
"ip": {
"type": "ip"
}
}
}
}
}
],
"properties": {
"source": {
"type": "object",
"dynamic": true
},
"destination": {
"type": "object",
"dynamic": true
}
}
}
}
}
POST /tenant-newevents-1/log
{
"source": {
"name": {
"first": "John",
"last": "Doe"
},
"ip": "1.2.3.4"
},
"destination": {
"name": {
"first": "Jane",
"last": "Doe"
},
"ip": "3.4.5.6"
}
}
GET /tenant-newevents-1
這上面沒有工作...
我有的是這些相同的方案來匹配(〜20)。
非常感謝您的幫助!
看起來不錯。剛剛嘗試過ES 5和6,並且運行良好。請說明你如何創建索引/映射? – Val
curl -XPOST「locallhost:9200/_template/mapping-events」[email protected] – moutonjr
好的一個!那麼mymapping.json的內容呢? – Val