yangcctv 发表于 2017-5-20 12:34:56

Elasticsearch模块功能之-映射(Mapper)

  Elasticsearch模块功能之-映射(Mapper)
当创建索引或者使用put mapping Api操作时,mapper模块主要负责将类型映射的定义添加到索引上。同时也支持预先没有定义的动态映射类型。
1、动态映射:
         索引一篇文档时新的“类型”可以动态添加。当遇到一个新的字段类型时,Elasticsearch可以自动检测数据类型并能自动添加类型映射。
2、默认映射:
         当创建一个新的“类型”时,Elasticsearch使用_defualt_映射作为他的基础“类型”,任何建索引或者添加映射时指定的映射将覆盖掉默认值。默认映射的定义如下:
 
 view plaincopy 



[*]{  
[*]  
[*]    _default_ : {  
[*]  
[*]    }  
[*]  
[*]}  

 
3、配置映射
         映射可以在名为.json的文件中定义,该文件需要放在config/mappings/_default后者config/mappings/的位置下面。
 
【参考】http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping.html
 
from  http://blog.csdn.net/changong28/article/details/38406191
页: [1]
查看完整版本: Elasticsearch模块功能之-映射(Mapper)