【发布时间】:2017-07-10 17:13:53
【问题描述】:
我有一个称为测试执行的概念实体,每个测试执行都应该是 Elasticsearch 索引中的一个单独的类型。每个测试执行类型的映射应该相同,并且会动态添加到索引中。
我已经为单个测试执行创建了一个映射,如下所示,我希望将其推广到将来将创建的所有类型。
PUT /test_tool/_mapping/test_execution_20151710_1324_12
{
"properties": {
"timestamp":{
"type": "string",
"index": "not_analyzed"
},
"source":{
"type": "string",
"index": "not_analyzed"
},
"payload":{
"type": "string",
"index": "not_analyzed"
}
}
}
我应该如何为动态类型创建一个通用映射,例如:为类型“test_execution_*”创建一个通配符。
[更新]
看了下面的答案后,我考虑过不要对不同的执行使用单独的类型,并希望在同一个测试执行中使用单独的键来识别文档。
PUT /test_tool/_mapping/executions
{
"properties": {
"timestamp":{
"type": "string",
"index": "not_analyzed"
},
"source":{
"type": "string",
"index": "not_analyzed"
},
"payload":{
"type": "string",
"index": "not_analyzed"
},
"test_execution":{
"type": "string",
"index": "not_analyzed"
}
}
}
【问题讨论】:
标签: elasticsearch elasticsearch-5