Im trying to make suggestions to users based on several factors:
•Suggestions MUST only be students from the same college
•Suggestions MUST match at least one other field
Here is how I am currently doing it , but this does not seem right or efficent considering most of these fields are bool's .....if the colleges dont line up why bother even doing that query ?
POST /interests_percolator/UNIQUE_INTERESTS/_percolate/
{
"doc":{
"message":"Bring it eminem"
}
}
DELETE discovery
PUT discovery
{
"mappings": {
"user": {
"properties": {
"hashtag_bio": {
"type": "string"
},
"college": {
"type": "string"
},
"college_class": {
"type": "string"
}
}
}
}
}
PUT /discovery/.percolator/1
{
"query": {
"bool": {
"must": [
{ "match": { "college":{
"query" : "Oakland University",
"type" : "phrase"
}}}
],
"should": [
{ "match": { "hashtag_bio": "#poznasty" }},
{ "match": { "college_class": "BIO_310"}},
{ "match": { "college_class": "WRT_100"}}
],
"minimum_should_match": 1
}
}
}
PUT /discovery/.percolator/2
{
"query": {
"bool": {
"must": [
{ "match": { "college":{
"query" : "Oakland University",
"type" : "phrase"
}}}
],
"should": [
{ "match": { "hashtag_bio": "#Chipotle"}}
],
"minimum_should_match": 1
}
}
}
PUT /discovery/.percolator/3
{
"query": {
"bool": {
"must": [
{ "match": { "college":{
"query" : "Oakland University",
"type" : "phrase"
}}}
],
"should": [
{ "match": { "college_class": "ART_400"}}
],
"minimum_should_match": 1
}
}
}
POST /discovery/user/_percolate/
{
"doc":{
"hashtag_bio":"#Chipotle",
"college":"Oakland University"
}
}