浅谈ElasticSearch的嵌套存储模型
- - ITeye博客最近一个半月都在搞SparkStreaming+Hbase+Redis+ES相关的实时流项目开发,其中重度使用了ElasticSearch作为一个核心业务的数据存储,所以这段时间更新文章较少,现在开发基本完事,接下来的会写几篇有关ElastiSearch的使用心得. 大多数时候我们使用es都是用来存储业务比较简单的数据,比如日志log类居多,就算有一些有主外键关联的数据,我们也会提前join好,然后放入es中存储.
{
"order": 0,
"template": "work*",
"settings": {
"index": {
"number_of_replicas": "0",
"number_of_shards": "3"
}
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"nested_kps": {
"mapping": {
"type": "nested"
},
"path_match": "quests.kps"
}
},
{
"nested_quests": {
"mapping": {
"type": "nested"
},
"match": "quests"
}
},
{
"string_fields": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match": "*",
"match_mapping_type": "string"
}
},
{
"message": {
"mapping": {
"index": "analyzed",
"type": "string"
},
"match": "message",
"match_mapping_type": "string"
}
},
{
"date_fields": {
"mapping": {
"doc_values": true,
"type": "date"
},
"match": "*",
"match_mapping_type": "date"
}
},
{
"float_fields": {
"mapping": {
"doc_values": true,
"type": "float"
},
"match": "*",
"match_mapping_type": "float"
}
},
{
"double_fields": {
"mapping": {
"doc_values": true,
"type": "double"
},
"match": "*",
"match_mapping_type": "double"
}
},
{
"integer_fields": {
"mapping": {
"doc_values": true,
"type": "integer"
},
"match": "*",
"match_mapping_type": "integer"
}
},
{
"long_fields": {
"mapping": {
"doc_values": true,
"type": "long"
},
"match": "*",
"match_mapping_type": "long"
}
}
],
"_all": {
"enabled": false
}
}
},
"aliases": {}
}