Skip to content

Instantly share code, notes, and snippets.

@beng
Last active April 28, 2016 16:46
Show Gist options
  • Save beng/f3d34ed66e851ea3941fec8e9fbcdb1b to your computer and use it in GitHub Desktop.
Save beng/f3d34ed66e851ea3941fec8e9fbcdb1b to your computer and use it in GitHub Desktop.
fast elastic writes from @adkatrit (github.com/adkatrit)
#!/bin/bash
# fast elastic writes from @adkatrit (http://github.com/adkatrit)
INDEX=$1
ES_SOCKET=$2
#Create index
curl -XPUT "$ES_SOCKET/$INDEX/"
#replicas
curl -XPUT "$ES_SOCKET/$INDEX/_settings" -d '{
"index" : {
"number_of_replicas" : 0
}
}'
echo "";
#Close index
curl -XPOST "$ES_SOCKET/$INDEX/_close"
echo "";
#refresh rate
curl -XPUT "$ES_SOCKET/$INDEX/_settings" -d '{
"index" : {
"refresh_interval" :-1
}
}'
echo "";
#merge policy
curl -XPUT "$ES_SOCKET/$INDEX/_settings" -d '{
"index" : {
"index.merge.policy.merge_factor" : 30
}
}'
echo "";
#flush -- only necessary for bulk loading
curl -XPUT "$ES_SOCKET/$INDEX/_settings" -d '{
"index":{
"index.translog.flush_threshold_size":10000
}
}'
echo "";
#buffer
curl -XPUT "$ES_SOCKET/$INDEX/_settings" -d '{
"index":{
"indices.memory.index_buffer_size": 30
}
}'
echo "";
curl -XPOST "$ES_SOCKET/$INDEX/_open"
echo "";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment