Created
September 30, 2011 20:04
-
-
Save cdolivares/1254824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parent document mapping | |
{ | |
"parent" : { | |
"properties" : { | |
"headline" : { | |
"type" : "string" | |
}, | |
"doc_score" : { | |
"type" : "long" | |
}, | |
"show" : { | |
"type" : "boolean" | |
} | |
} | |
} | |
} | |
Child document mapping | |
{ | |
"child" : { | |
"_routing" : { | |
"required" : true | |
}, | |
"properties" : { | |
"subject_name" : { | |
"type" : "string" | |
}, | |
"points" : { | |
"type" : "long" | |
} | |
} | |
} | |
} | |
Elastic Search Query | |
{ | |
"query" : { | |
"filtered" : { | |
"query" : { | |
"custom_score" : { | |
"query" : { | |
"has_child" : { | |
"type" : "expertise", | |
"query" : { | |
"flt" : { | |
"fields" : ["subject_name"], | |
"like_text" : "Finance" | |
} | |
} | |
} | |
}, | |
"script" : "_score * doc['doc_score'].value" | |
} | |
}, | |
"filter" : { | |
"not" : { | |
"term" : { | |
"show" : 0 | |
} | |
} | |
} | |
} | |
}, | |
"size" : 200 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment