Skip to content

Instantly share code, notes, and snippets.

@jprante
Created November 22, 2012 13:36
Show Gist options
  • Save jprante/4131203 to your computer and use it in GitHub Desktop.
Save jprante/4131203 to your computer and use it in GitHub Desktop.
Percolate with integers
#!/bin/bash
curl -XDELETE 'localhost:9200/notifave'
curl -XDELETE 'localhost:9200/_percolator'
curl -XPUT 'localhost:9200/notifave' -d '
{
"mappings" : {
"article" : {
"properties" : {
"category" : {
"type" : "integer"
}
}
}
}
}
'
curl -XGET 'localhost:9200/notifave/_mapping?pretty'
curl -XPUT 'localhost:9200/_percolator/notifave/category-1' -d '{
"query" : {
"query_string" : {
"query" : 1,
"default_field": "category"
}
}
}'
curl -XPUT 'localhost:9200/_percolator/notifave/category-2' -d '{
"query" : {
"query_string" : {
"query" : 2,
"default_field": "category"
}
}
}'
curl -XPUT 'localhost:9200/_percolator/notifave/category-3' -d '{
"query" : {
"query_string" : {
"query" : 3,
"default_field": "category"
}
}
}'
curl -XGET 'localhost:9200/_refresh'
curl -XGET 'localhost:9200/notifave/article/_percolate' -d '{
"doc" : {
"title": "Some title with 3",
"category" : 1
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment