Skip to content

Instantly share code, notes, and snippets.

@onilton
Created January 25, 2012 19:43
Show Gist options
  • Save onilton/1678150 to your computer and use it in GitHub Desktop.
Save onilton/1678150 to your computer and use it in GitHub Desktop.
Reproduce possible percolator bug
#!/bin/bash
echo ; echo
echo "Create test index"
curl -XPUT localhost:9200/testindex?pretty=true
echo ; echo
echo "Insert doc 1"
curl -XPUT http://localhost:9200/testindex/article/1?pretty=true -d '{
"name" : "Shay Banon"
}'
echo ; echo
echo "Insert doc 2"
curl -XPUT http://localhost:9200/testindex/article/2?pretty=true -d '{
"name" : "michael jackson"
}'
echo ; echo
echo "Insert query 1 in percolator"
curl -XPUT localhost:9200/_percolator/testindex/1?pretty=true -d '{
"query" : {
"query_string" : {
"query" : "michael"
}
}
}'
echo ; echo
echo "Insert query 2 in percolator"
curl -XPUT localhost:9200/_percolator/testindex/2?pretty=true -d '{
"query" : {
"query_string" : {
"query" : "banon"
}
}
}'
echo ; echo
echo "Percolate incoming doc 1"
curl -XGET localhost:9200/testindex/article/_percolate?pretty=true -d '{
"doc" : {
"name" : "banon"
}
}'
echo ; echo
echo "Percolate incoming doc 2"
curl -XGET localhost:9200/testindex/article/_percolate?pretty=true -d '{
"doc" : {
"name" : "michael"
}
}'
echo ; echo
echo "Delete testindex from percolator"
curl -XDELETE localhost:9200/_percolator/testindex
##Deleting the queries one by one works
#curl -XDELETE localhost:9200/_percolator/testindex/1?pretty=true
#curl -XDELETE localhost:9200/_percolator/testindex/2?pretty=true
echo ; echo
echo "Percolate incoming doc 1 again"
curl -XGET localhost:9200/testindex/article/_percolate?pretty=true -d '{
"doc" : {
"name" : "banon"
}
}'
echo ; echo
echo "Get info for query 1 n"
curl -XGET localhost:9200/_percolator/testindex/1?pretty=true
echo ; echo
echo "Percolate incoming doc 2 again"
curl -XGET localhost:9200/testindex/article/_percolate?pretty=true -d '{
"doc" : {
"name" : "michael"
}
}'
echo ; echo
echo "Get info for query 2 n"
curl -XGET localhost:9200/_percolator/testindex/2?pretty=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment