Skip to content

Instantly share code, notes, and snippets.

@kierangraham
Created July 11, 2012 16:17
Show Gist options
  • Save kierangraham/3091506 to your computer and use it in GitHub Desktop.
Save kierangraham/3091506 to your computer and use it in GitHub Desktop.
{
"query": {
"query_string": {
"query": "australia"
},
"custom_score": {
"query": {
"custom_filters_score": {
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "australia"
}
}
]
}
},
"filters": [
{
"filter": {
"term": {
"type": "video"
}
},
"boost": 1
},
{
"filter": {
"term": {
"type": "image"
}
},
"boost": 1
},
{
"filter": {
"term": {
"type": "text"
}
},
"boost": 1
}
],
"score_mode": "first"
},
"script": "_score * ((doc['popularity'] + 1) / 0.25)"
}
}
},
"facets": {
"title": {
"terms": {
"field": "title",
"size": 10,
"all_terms": false
}
},
"content": {
"terms": {
"field": "content",
"size": 10,
"all_terms": false
}
},
"authors": {
"terms": {
"field": "authors.name",
"size": 10,
"all_terms": false
}
},
"contributors": {
"terms": {
"field": "contributors.name",
"size": 10,
"all_terms": false
}
},
"tags": {
"terms": {
"field": "categories",
"size": 10,
"all_terms": false
}
},
"type": {
"terms": {
"field": "type",
"size": 10,
"all_terms": false
}
}
},
"size": 10,
"from": 0
}
{
"query": {
"query_string": {
"query": "australia"
},
"custom_score": {
"query": {
"custom_filters_score": {
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "australia"
}
}
]
}
},
"filters": [
{
"filter": {
"term": {
"type": "video"
}
},
"boost": 163
},
{
"filter": {
"term": {
"type": "image"
}
},
"boost": 9
},
{
"filter": {
"term": {
"type": "text"
}
},
"boost": 303
}
],
"score_mode": "first"
},
"script": "_score * ((doc['popularity'] + 1) / 0.25)"
}
}
},
"facets": {
"title": {
"terms": {
"field": "title",
"size": 10,
"all_terms": false
}
},
"content": {
"terms": {
"field": "content",
"size": 10,
"all_terms": false
}
},
"authors": {
"terms": {
"field": "authors.name",
"size": 10,
"all_terms": false
}
},
"contributors": {
"terms": {
"field": "contributors.name",
"size": 10,
"all_terms": false
}
},
"tags": {
"terms": {
"field": "categories",
"size": 10,
"all_terms": false
}
},
"type": {
"terms": {
"field": "type",
"size": 10,
"all_terms": false
}
}
},
"size": 10,
"from": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment