Skip to content

Instantly share code, notes, and snippets.

@nik9000
Created August 20, 2013 21:33
Show Gist options
  • Save nik9000/6287620 to your computer and use it in GitHub Desktop.
Save nik9000/6287620 to your computer and use it in GitHub Desktop.
Lack of confidence
#!/bin/bash
curl -XDELETE "http://localhost:9200/test?pretty" -s > log
curl -XPOST "http://localhost:9200/test?pretty" -s -d '{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 0,
"analysis":{
"analyzer":{
"suggest":{
"type": "custom",
"tokenizer": "standard",
"filter": [ "standard", "lowercase", "suggest_shingle" ]
}
},
"filter":{
"suggest_shingle":{
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 5,
"output_unigrams": true
}
}
}
}
}
}' >> log
curl -XPOST "http://localhost:9200/test/test/_mapping?pretty" -s -d '{
"test":{
"properties": {
"foo":{
"type": "multi_field",
"fields": {
"foo": {
"type": "string",
"analyzer": "default"
},
"suggest": {
"type": "string",
"analyzer":"suggest"
}
}
}
}
}
}' >> log
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true&wait_for_status=yellow' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "nobel prize"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble gases"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble somethingelse"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble somethingelse2"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble somethingelse3"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble somethingelse4"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble somethingelse5"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble somethingelse6"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "noble somethingelse7"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "somethingelse prize"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "pride and joy"}' -s >> log
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{"foo": "notes are fun"}' -s >> log
curl -XPOST "http://localhost:9200/test/_refresh?pretty" -s >> log
curl -XGET "http://localhost:9200/test/_suggest?pretty" -s -d '{
"text": "nobel prize",
"example_phrase": {
"phrase": {
"field": "foo.suggest",
"max_errors": 5,
"size": 2,
"confidence": 2,
"direct_generator" : [ {
"field": "foo.suggest",
"suggest_mode": "always",
"max_term_freq": 0.999999
} ]
}
}
}' | tee -a log
curl -XGET "http://localhost:9200/test/_suggest?pretty" -s -d '{
"text": "nobel prize",
"example_phrase": {
"phrase": {
"field": "foo.suggest",
"max_errors": 5,
"size": 2,
"confidence": 0,
"direct_generator" : [ {
"field": "foo.suggest",
"suggest_mode": "always",
"max_term_freq": 0.999999
} ]
}
}
}' | tee -a log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment