Skip to content

Instantly share code, notes, and snippets.

@ronpastore
Last active December 19, 2015 14:38
Show Gist options
  • Save ronpastore/5970509 to your computer and use it in GitHub Desktop.
Save ronpastore/5970509 to your computer and use it in GitHub Desktop.
not able to get a match on percolate with constant score. ElasticSearch Version: 0.19.10, JVM: 20.6-b01-415
#updated: fix below
curl -X PUT "http://localhost:9200/segments__1369334274"
curl -X PUT "http://localhost:9200/_percolator/segments__1369334274/test_percolator_query" -d '{
"constant_score" : {
"filter" : {
"term" : {
"topics" : ["aging"]
}
},
"query" : {
"query_string" : {
"query" : "*"
}
},
"boost" : 1.2
}
}'
curl -XPOST localhost:9200/_percolator/_refresh
#Percolate Doc that Should Match
curl -X GET "http://localhost:9200/segments__1369334274/segment/_percolate?pretty=1" -d '{
"doc":{
"id":"51dc70e0e54206213b000003",
"type":"segment",
"title":"hmmm",
"description":"hmmm",
"topics":["aging"]
}
}'
#####THE FIX: Wrap the constant_score in a query object###########
curl -X PUT "http://localhost:9200/_percolator/segments__1369334274/test_percolator_query" -d '{
"query" : {
"constant_score" : {
"filter" : {
"term" : {
"topics" : ["aging"]
}
},
"query" : {
"query_string" : {
"query" : "*"
}
},
"boost" : 1.2
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment