Skip to content

Instantly share code, notes, and snippets.

@imotov
Created January 8, 2013 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imotov/111db5810fadcbf5f4c8 to your computer and use it in GitHub Desktop.
Save imotov/111db5810fadcbf5f4c8 to your computer and use it in GitHub Desktop.
filter_or_query.sh
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"settings": {
"index.number_of_shards": 1
}
}'
echo
for i in {1..10}; do curl -XPUT localhost:9200/test/doc/$i -d "{\"foo\":\"bar\", \"doc\":\"$i\"}"; done
echo
curl -XPOST localhost:9200/test/_refresh
echo
curl localhost:9200/test/doc/_search -d '{
"query":{
"filtered":{
"query": {
"constant_score" : {
"filter" : {
"script" : {
"script" : "System.out.println(\"query \" + doc.doc.value); doc.doc.value == 5 || doc.doc.value == 7"
}
}
}
},
"filter": {
"terms" : {"doc": [5, 7]}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment