Skip to content

Instantly share code, notes, and snippets.

@deepakhj
Created August 9, 2016 16:55
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 deepakhj/2fa12b20b1d51312ec9e42d2654d0a8b to your computer and use it in GitHub Desktop.
Save deepakhj/2fa12b20b1d51312ec9e42d2654d0a8b to your computer and use it in GitHub Desktop.
curl 'http://localhost:9200/foods/_search' --data $'{
"profile": true,
"from": 0,
"size": 125,
"query": {
"filtered": {
"query": {
"function_score": {
"query": {
"match": {
"brand_description": {
"query": "orange",
"type": "boolean"
}
}
},
"functions": [{
"filter": {
"term": {
"userId": "0"
}
},
"boost_factor": 1.5
}, {
"filter": {
"bool": {
"must": {
"term": {
"verified": "true"
}
},
"must_not": {
"term": {
"userId": "0"
}
}
}
},
"boost_factor": 1.03
}, {
"filter": {
"term": {
"userId": "0"
}
},
"script_score": {
"script": "_score*(1+1.5*log(doc[\'counts.usersCount\'].value+1)/log(10000000))"
}
}, {
"filter": {
"bool": {
"must": {
"term": {
"verified": "true"
}
},
"must_not": {
"term": {
"userId": "0"
}
}
}
},
"script_score": {
"script": "_score*(1+1.36*log(doc[\'signals.logged_count\'].value+doc[\'counts.usersCount\'].value+1)/log(10000000))"
}
}, {
"filter": {
"bool": {
"must": {
"term": {
"verified": "false"
}
},
"must_not": {
"term": {
"userId": "0"
}
}
}
},
"script_score": {
"script": "_score*(1+1.5*log(doc[\'counts.usersCount\'].value+1)/log(10000000))"
}
}, {
"filter": {
"term": {
"countryId": "254"
}
},
"boost_factor": 1.25
}],
"boost_mode": "multiply"
}
},
"filter": {
"bool": {
"must": [{
"bool": {
"should": [{
"term": {
"foodType": "0"
}
}, {
"term": {
"foodType": "1"
}
}]
}
}, {
"term": {
"deleted": "false"
}
}, {
"bool": {
"must_not": {
"bool": {
"must": {
"term": {
"verified": "true"
}
},
"must_not": {
"term": {
"userId": "0"
}
}
}
}
}
}, {
"term": {
"public": "true"
}
}]
}
}
}
},
"fields": ["id", "originalFoodId", "foodType", "brand", "description", "externalId", "externalVersion"]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment