Skip to content

Instantly share code, notes, and snippets.

@luhn
Created January 13, 2016 17:19
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 luhn/bfa22bbded20be33bdac to your computer and use it in GitHub Desktop.
Save luhn/bfa22bbded20be33bdac to your computer and use it in GitHub Desktop.
Elasticsearch query
{
"query": {
"filtered": {
"filter": {
"and": [
{
"term": {
"deleted": false
}
},
{
"term": {
"verified": true
}
}
]
},
"query": {
"boosting": {
"positive": {
"bool": {
"minimum_should_match": 0,
"should": {
"term": {
"has_reservations": true
}
},
"must": [
{
"bool": {
"should": [
{
"match": {
"name": {
"operator": "and",
"query": "My query",
"boost": 1.0,
"fuzziness": "AUTO"
}
}
},
{
"match": {
"cuisine": {
"operator": "and",
"query": "My query",
"boost": 0.5,
"fuzziness": "AUTO"
}
}
}
]
}
},
{
"terms": {
"cuisine_id": 14
}
}
]
}
},
"negative": {
"bool": {
"minimum_should_match": 1,
"should": [
{
"term": {
"closed": true
}
}
]
}
},
"negative_boost": 0.2
}
}
}
},
"from": 0,
"fields": [
"name"
],
"size": 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment