Skip to content

Instantly share code, notes, and snippets.

@cdolivares
Created September 30, 2011 20:04
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 cdolivares/1254824 to your computer and use it in GitHub Desktop.
Save cdolivares/1254824 to your computer and use it in GitHub Desktop.
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