Mike Tougeron
Well-known member
At IGN we use the following _mapping for our ElasticSearch index. For about ~3 million messages this reduced the size of our index by > 30%.
Code:
curl -XPUT 'http://localhost:9200/xenforo_ign/post/_mapping' -d '
{
"post" : {
"_source" : {
"enabled" : false
},
"properties" : {
"message" : {"type" : "string", "store" : "no"},
"title" : {"type" : "string", "store" : "no", "index" : "no"},
"date" : {"type" : "long", "store" : "yes"},
"user" : {"type" : "long", "store" : "yes"},
"discussion_id" : {"type" : "long", "store" : "yes"},
"node" : {"type" : "long", "store" : "no"},
"prefix" : {"type" : "long", "store" : "no"},
"thread" : {"type" : "long", "store" : "no", "index" : "no"}
}
}
}'
curl -XPUT 'http://localhost:9200/xenforo_ign/thread/_mapping' -d '
{
"thread" : {
"_source" : {
"enabled" : false
},
"properties" : {
"message" : {"type" : "string", "store" : "no", "index" : "no"},
"title" : {"type" : "string", "store" : "no"},
"date" : {"type" : "long", "store" : "yes"},
"user" : {"type" : "long", "store" : "yes"},
"discussion_id" : {"type" : "long", "store" : "yes"},
"thread_id" : {"type" : "long", "store" : "yes"},
"node" : {"type" : "long", "store" : "no"},
"prefix" : {"type" : "long", "store" : "no"},
"thread" : {"type" : "long", "store" : "no", "index" : "no"}
}
}
}'
$> curl 'http://localhost:9200/xenforo_ign/_settings'
{
"xenforo_ign": {
"settings": {
"index.analysis.analyzer.default.language": "English",
"index.analysis.analyzer.default.type": "snowball",
"index.number_of_replicas": "1",
"index.number_of_shards": "5"
}
}
}
$> curl 'http://localhost:9200/xenforo_ign/_settings'
{
"_shards": {
"failed": 0,
"successful": 10,
"total": 10
},
"indices": {
"xenforo_ign": {
"docs": {
"deleted_docs": 3714,
"max_doc": 3437784,
"num_docs": 3434070
},
"index": {
"primary_size": "1.4gb",
"primary_size_in_bytes": 1574012401,
"size": "2.9gb",
"size_in_bytes": 3148021951
},
"merges": {
"current": 0,
"total": 3302,
"total_time": "33.5m",
"total_time_in_millis": 2010177
},
"refresh": {
"total": 31017,
"total_time": "29.9m",
"total_time_in_millis": 1794563
},