Skip to content

Instantly share code, notes, and snippets.

@Vineeth-Mohan
Created August 3, 2012 05:47
Show Gist options
  • Select an option

  • Save Vineeth-Mohan/3244856 to your computer and use it in GitHub Desktop.

Select an option

Save Vineeth-Mohan/3244856 to your computer and use it in GitHub Desktop.
vineeth@vineeth-XPS-L501X:~/elasticSearch$ cat rest.sh
#!/bin/bash
if [ -z $1 ] ; then
echo "Please enter hostname"
exit
fi
hostname=$1
curl -X DELETE "http://$hostname:9200/algotree"
echo
curl -X PUT "http://$hostname:9200/algotree" -d '{ "settings" : { "index" : { "number_of_shards" : 2, "number_of_replicas" : 1 ,
"analysis":{
"analyzer":{
"standard":{
"type" : "snowball"
},
"content":{
"type" : "custom",
"tokenizer" : "standard",
"filter" : ["lowercase", "stemmer","stop"],
"char_filter" : ["html_strip"]
}
}
}}}}'
echo
curl -X PUT "http://$hostname:9200/algotree/news/_mapping" -d '{
"public" :{
"properties" :{
"Content" : { "type" : "string" , "store" : "yes","Analyzer":"content" },
"standard" : { "type" : "string" , "store" : "yes" }
}
}
}'
echo
curl -XGET 'localhost:9200/algotree/_analyze?field=Content' -d '<html>this is Vineeth Mohan here </html>' | python -mjson.tool
curl -XGET 'localhost:9200/algotree/_analyze?field=standard' -d '<html> this is Vineeth Mohan here </html>' | python -mjson.tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment