Created
March 15, 2013 11:12
-
-
Save ofavre/5169100 to your computer and use it in GitHub Desktop.
Curl recreation for Combo Analyzer demo with frankzappasmoustache's configuration
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 | |
# Install ES 0.90.0.Beta1 | |
[ -f elasticsearch-0.90.0.Beta1.tar.gz ] || wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.Beta1.tar.gz -O elasticsearch-0.90.0.Beta1.tar.gz | |
mkdir es-combo-demo | |
tar xf elasticsearch-0.90.0.Beta1.tar.gz -C es-combo-demo | |
cd es-combo-demo/elasticsearch-0.90.0.Beta1 | |
# Configure it | |
cat >config/elasticsearch.yml <<EOF | |
cluster.name: elasticsearch-demo-combo | |
http.port: 9242 | |
index.number_of_shards: 1 | |
index.number_of_replicas: 0 | |
discovery.zen.ping.multicast.enabled: false | |
discovery.zen.ping.unicast.hosts: [] | |
index: | |
analysis: | |
analyzer: | |
ngram: | |
tokenizer: whitespace | |
filter: | |
- standard | |
- lowercase | |
- ngram | |
- catenate_words | |
combo: | |
type: combo | |
sub_analyzers: | |
- standard | |
- ngram | |
filter: | |
catenate_words: | |
type: word_delimiter | |
catenate_all: true | |
generate_word_parts: true | |
generate_number_parts: false | |
split_on_case_change: false | |
split_on_numerics: false | |
preserve_original: true | |
stem_english_possessive: false | |
ngram: | |
type: nGram | |
min_gram: 3 | |
max_gram: 50 | |
EOF | |
# Install the Combo Analyzer plugin | |
bin/plugin -install com.yakaz.elasticsearch.plugins/elasticsearch-analysis-combo/1.3.0 | |
# Start Es | |
bin/elasticsearch -f & | |
pid=$! | |
# Wait for it | |
while ! curl -s -XGET 'http://localhost:9242/_cluster/health' > /dev/null; do sleep 1; done | |
curl -s -XGET 'http://localhost:9242/_cluster/health?wait_for_status=green' > /dev/null | |
# Test | |
curl -XPUT 'http://localhost:9242/indexname/' | |
sleep 1 | |
curl -XGET 'http://localhost:9242/indexname/_analyze?analyzer=combo&text=hello%20world&pretty=true' | |
# Shut it down | |
curl -XPOST 'http://localhost:9242/_shutdown' | |
wait $pid | |
# Clean up | |
cd ../.. | |
rm -Rf es-combo-demo/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try running this several times
and you'll get an error: