ElasticSearch Tune for disk usage Translation
PUT index
{
"mappings": {
"_doc": {
"properties": {
"foo": {
"type": "integer",
"index": false
}
}
}
}
}text:该属性在索引中存储了作为文档计分所需要的基本的因素,如果你索引的只是文本而不关注文本分数,那么你可以配置该索引不使用norms参数
PUT index
{
"mappings": {
"_doc": {
"properties": {
"foo": {
"type": "text",
"norms": false
}
}
}
}
}text:默认情况下该属性还存储了frequencies和positions两个属性,第一个属性在积分系统中被使用到,第二个在短语查询中使用到。如果你不需要执行短语查询,那么你可以禁用positions属性
PUT index
{
"mappings": {
"_doc": {
"properties": {
"foo": {
"type": "text",
"index_options": "freqs"
}
}
}
}
}
另外,如果你不关心计分系统,你可以配置es在每个查询中仅仅索引文档。当然你也可以索引这个字段,但是短语查询将会报错并且计分系统会假定每次查询在每个文档中只会出现一次
PUT index
{
"mappings": {
"_doc": {
"properties": {
"foo": {
"type": "text",
"norms": false,
"index_options": "freqs"
}
}
}
}
}
2.不要使用默认动态字符串映射
PUT index
{
"mappings": {
"_doc": {
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
]
}
}
}
3.关注你的分片大小