I am creating the index template and define mapping in it.
Default Elasticsearch Settings
Sent data of size (on disk) 737 MB (173,170 Documents) to Elasticsearch, its size on elasticsearch is 320.1mb (default elasticsearch index setting)
Template Settings
Then I created a template and sent same data again.
PUT /_template/example-name
{
"template" : "example-name*",
"index_patterns" : [
"example-pattern*"
],
"settings" : {
"index" : {
"number_of_shards" : "5",
"number_of_replicas" : "0",
"refresh_interval" : "5s"
}
}
Now the size is increased.
Size = 956.2mb
Documents = 173,170
Used Index Compression Settings
So i found an index setting for compression here https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#_static_index_settings
i.e. index.codec : best compression
Used this settings:
"settings" : {
"index" : {
"number_of_shards" : "5",
"number_of_replicas" : "0",
"refresh_interval" : "5s",
"codec" : "best_compression"
}
And now, size is 843.8mb.
Could you please suggest how to do the index optimization and make sure the size reduces?