This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delete all data | |
curl -XDELETE localhost:9200/test | |
# create an index and define specific french stop_words | |
curl -XPUT localhost:9200/test -d '{ | |
"settings" : { | |
"index" : { | |
"analysis" : { | |
"analyzer" : { | |
"french" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm | |
function map() { | |
emit(1, // Or put a GROUP BY key here | |
{sum: this.value, // the field you want stats for | |
min: this.value, | |
max: this.value, | |
count:1, | |
diff: 0, // M2,n: sum((val-mean)^2) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kibana 3 against ElasticSearch 1.4 throws an **Connection Failed** screen. The error text says to set `http.cors.allow-origin`, but it misses out the important `http.cors.enabled: true` | |
Working config: | |
$ grep cors elasticsearch-1.4.0.Beta1/config/elasticsearch.yml | |
http.cors.allow-origin: "/.*/" | |
http.cors.enabled: true | |
* [Ref](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-http.html) | |
* [Ref](http://elasticsearch-users.115913.n3.nabble.com/Kibana-upgrade-trouble-nor-4-0BETA1-neither-3-11-work-now-td4064625.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb | |
sudo dpkg -i puppetlabs-release-precise.deb | |
sudo apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################################################## | |
# use case: training a classifier | |
# | |
# Many systems classify documents by assigning “tag” or “category” fields. Classifying | |
# documents can be a tedious manual process and so in this example we will train a classifier | |
# to automatically spot keywords in new documents that suggest a suitable category. | |
curl -XGET "http://localhost:9200/products_fr/_search" -d' | |
{ | |
"query": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script demonstrates the usage of Elasticsearch's Ngram Tokenizer | |
curl -XDELETE localhost:9200/test?pretty=true | |
curl -XPUT localhost:9200/test?pretty=true -d '{ | |
"settings":{ | |
"analysis":{ | |
"analyzer":{ | |
"my_ngram_analyzer":{ | |
"tokenizer":"my_ngram_tokenizer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script installs Scala 2.10.3 with SBT 0.13 on Ubuntu 12.04 | |
wget http://www.scala-lang.org/files/archive/scala-2.10.3.tgz | |
tar zxf scala-2.10.3.tgz sudo mv scala-2.10.3 /usr/local/share/scala | |
sudo ln -s /usr/local/share/scala/bin/scala /usr/bin/scala | |
sudo ln -s /usr/local/share/scala/bin/scalac /usr/bin/scalac | |
sudo ln -s /usr/local/share/scala/bin/fsc /usr/bin/fsc | |
sudo ln -s /usr/local/share/scala/bin/scaladoc /usr/bin/scaladoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ES='http://localhost:9200' | |
ESIDX='test3' | |
ESTYPE='test' | |
curl -XDELETE $ES/$ESIDX | |
curl -XPUT $ES/$ESIDX/ -d '{ | |
"settings" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -e hadoop-2.4.0-src.tar.gz ]; then | |
echo "Skipping Apache Hadoop 2.4 download" | |
else | |
echo "Downloading Apache Hadoop 2.4" | |
wget "http://apache.crihan.fr/dist/hadoop/common/current/hadoop-2.4.0-src.tar.gz" | |
tar xzvf hadoop-2.4.0-src.tar.gz | |
cd hadoop-* | |
mvn package -Pdist,native -Dskiptests -Dtar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the MD5 sum of the current directory | |
find . -type f | grep -v "^./.git" | xargs md5 | md5 |